`<!-- BelSmart blog: Local Presence Dialing: Does It Still Raise Answer Rates?
Paste into a page or post that allows and <script> (e.g. a self-hosted WordPress "Custom HTML" block).<br>
Use the page's title field for the H1. Substack and WordPress.com free plans strip this code. --></p>
<div id="bsl-local">
<style>
@import url('https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,400;0,600;0,800;1,400&display=swap');
#bsl-local {
--ink: #17202B;
--muted: #5A6472;
--line: #DCE1E7;
--surface: #F3F5F8;
--signal: #1D4E89;
--signal-soft: #E7EEF8;
--spam: #C2362F;
--spam-soft: #FBEAE8;
--verified: #1F7A4D;
--verified-soft: #E5F3EB;
--focus: #2F6FE0;
font-family: 'Figtree', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
font-size: 18px;
line-height: 1.65;
color: var(--ink);
max-width: 720px;
margin: 0 auto;
}
#bsl-local *, #bsl-local *::before, #bsl-local *::after { box-sizing: border-box; }
#bsl-local p { margin: 0 0 1.1em; }
#bsl-local h2 { font-size: 1.75rem; line-height: 1.22; font-weight: 800; letter-spacing: -0.02em; margin: 2.4em 0 0.55em; scroll-margin-top: 90px; }
#bsl-local h3 { font-size: 1.15rem; line-height: 1.35; font-weight: 600; margin: 1.7em 0 0.35em; }
#bsl-local a { color: var(--signal); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color .2s; }
#bsl-local a:hover { color: var(--ink); }
#bsl-local ul, #bsl-local ol { padding-left: 1.25em; margin: 0 0 1.2em; }
#bsl-local li { margin-bottom: 0.5em; }
#bsl-local a:focus-visible, #bsl-local button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
/* Reading progress */
#bsl-local .bsl-progress { position: fixed; top: 0; left: 0; width: 100%; height: 3px; background: var(--signal); transform: scaleX(0); transform-origin: 0 50%; z-index: 9999; transition: transform .1s linear; }
/* Caller ID demo: the signature element */
#bsl-local .bsl-demo { display: grid; grid-template-columns: 230px 1fr; gap: 32px; align-items: start; background: var(--surface); border-radius: 22px; padding: 28px; margin: 2em 0 2.4em; }
#bsl-local .bsl-phone { width: 230px; height: 440px; border-radius: 38px; background: var(--ink); padding: 10px; box-shadow: 0 18px 40px rgba(23,32,43,.22); }
#bsl-local .bsl-screen { position: relative; height: 100%; border-radius: 30px; overflow: hidden; background: #2A3442; color: #fff; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 64px 18px 26px; transition: background .5s ease; }
#bsl-local .bsl-screen[data-state="spam"] { background: #4A2427; }
#bsl-local .bsl-screen[data-state="branded"] { background: #1C3A2E; }
#bsl-local .bsl-screen[data-state="local"] { background: #1F3350; }
#bsl-local .bsl-incoming { font-size: 0.8rem; opacity: .7; margin: 0 0 18px; }
#bsl-local .bsl-avatar { width: 70px; height: 70px; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; margin-bottom: 14px; transition: background .5s; }
#bsl-local .bsl-screen[data-state="branded"] .bsl-avatar { background: var(--verified); }
#bsl-local .bsl-screen[data-state="spam"] .bsl-avatar { background: var(--spam); }
#bsl-local .bsl-swap { transition: opacity .28s ease, transform .28s ease; }
#bsl-local .bsl-swap.is-out { opacity: 0; transform: translateY(8px); }
#bsl-local .bsl-name { font-size: 1.3rem; font-weight: 800; line-height: 1.2; margin: 0 0 4px; }
#bsl-local .bsl-sub { font-size: 0.85rem; opacity: .75; margin: 0 0 12px; }
#bsl-local .bsl-badge { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.14); min-height: 1.6em; }
#bsl-local .bsl-badge:empty { visibility: hidden; }
#bsl-local .bsl-screen[data-state="spam"] .bsl-badge { background: var(--spam); }
#bsl-local .bsl-screen[data-state="branded"] .bsl-badge { background: var(--verified); }
#bsl-local .bsl-buttons { margin-top: auto; display: flex; gap: 46px; }
#bsl-local .bsl-buttons span { width: 50px; height: 50px; border-radius: 50%; display: block; }
#bsl-local .bsl-buttons span:first-child { background: #D9483F; }
#bsl-local .bsl-buttons span:last-child { background: #2E9E5E; }
#bsl-local .bsl-screen.is-ringing .bsl-buttons span:last-child { animation: bslRing 1.2s ease-in-out 2; }
@keyframes bslRing { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
#bsl-local .bsl-demo-title { font-size: 1.2rem; font-weight: 800; margin: 56px 0 4px; }
#bsl-local .bsl-demo-lead { color: var(--muted); font-size: 0.95rem; margin: 0 0 14px; }
#bsl-local .bsl-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
#bsl-local .bsl-tab { font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; border: 1.5px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 99px; transition: background .2s, border-color .2s, color .2s; }
#bsl-local .bsl-tab:hover { border-color: var(--signal); }
#bsl-local .bsl-tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
#bsl-local .bsl-caption { min-height: 8.2em; font-size: 0.98rem; margin: 0; }
#bsl-local .bsl-caption strong { display: block; font-size: 1.6rem; line-height: 1.2; margin-bottom: 4px; }
/* Survey bars */
#bsl-local .bsl-bars { margin: 1.4em 0 1.8em; }
#bsl-local .bsl-bar { margin-bottom: 14px; }
#bsl-local .bsl-bar-label { display: flex; justify-content: space-between; font-size: 0.95rem; margin-bottom: 4px; }
#bsl-local .bsl-bar-label b { font-variant-numeric: tabular-nums; }
#bsl-local .bsl-track { height: 12px; background: var(--surface); border-radius: 99px; overflow: hidden; }
#bsl-local .bsl-fill { height: 100%; width: 0; border-radius: 99px; background: var(--signal); transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
#bsl-local .bsl-bar:nth-child(2) .bsl-fill { transition-delay: .12s; background: #5C7FAF; }
#bsl-local .bsl-bar:nth-child(3) .bsl-fill { transition-delay: .24s; background: #9AAECB; }
#bsl-local .bsl-bars-note { font-size: 0.85rem; color: var(--muted); }
/* Callouts */
#bsl-local .bsl-callout { border-left: 4px solid var(--signal); background: var(--signal-soft); padding: 14px 18px; border-radius: 0 12px 12px 0; margin: 1.4em 0; font-size: 0.97rem; }
#bsl-local .bsl-callout.is-legal { border-color: #D49A3A; background: #FCF2E1; }
/* Practices */
#bsl-local .bsl-steps li::marker { font-weight: 800; color: var(--signal); }
/* BelSmart panel */
#bsl-local .bsl-panel { border: 1.5px solid var(--line); border-radius: 20px; padding: 6px 28px 26px; margin: 2.6em 0; }
#bsl-local .bsl-panel h2 { margin-top: 1em; }
#bsl-local .bsl-cta { background: var(--ink); color: #fff; border-radius: 16px; padding: 24px 26px; margin-top: 1.4em; }
#bsl-local .bsl-cta-title { font-size: 1.3rem; font-weight: 800; margin: 0 0 6px; color: #fff; }
#bsl-local .bsl-cta p { color: #DCE3EC; }
#bsl-local .bsl-btn { display: inline-block; font-weight: 800; text-decoration: none; padding: 13px 24px; border-radius: 12px; background: #fff; color: var(--ink); transition: transform .18s ease, box-shadow .18s ease; }
#bsl-local .bsl-btn:hover { color: var(--ink); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.25); }
#bsl-local .bsl-btn-dark { background: var(--signal); color: #fff; }
#bsl-local .bsl-btn-dark:hover { color: #fff; }
/* FAQ accordion with smooth height transition */
#bsl-local .bsl-faq-item { border-top: 1px solid var(--line); }
#bsl-local .bsl-faq-item:last-child { border-bottom: 1px solid var(--line); }
#bsl-local .bsl-faq-q { all: unset; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; cursor: pointer; padding: 18px 2px; font-weight: 600; font-size: 1.05rem; }
#bsl-local .bsl-faq-q::after { content: "+"; font-size: 1.5rem; font-weight: 400; line-height: 1; color: var(--muted); transition: transform .3s ease; }
#bsl-local .bsl-faq-q[aria-expanded="true"]::after { transform: rotate(45deg); }
#bsl-local .bsl-faq-a { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
#bsl-local .bsl-faq-a > div { overflow: hidden; }
#bsl-local .bsl-faq-a.is-open { grid-template-rows: 1fr; }
#bsl-local .bsl-faq-a p { color: var(--muted); padding-right: 24px; }
#bsl-local .bsl-sources { font-size: 0.9rem; color: var(--muted); }
@media (max-width: 640px) {
#bsl-local { font-size: 17px; }
#bsl-local .bsl-demo-title { margin-top: 0; }
#bsl-local h2 { font-size: 1.45rem; }
#bsl-local .bsl-demo { grid-template-columns: 1fr; justify-items: center; padding: 22px 18px; }
#bsl-local .bsl-demo > div:last-child { width: 100%; order: 1; }
#bsl-local .bsl-phone { order: 2; }
#bsl-local .bsl-caption { min-height: 0; }
#bsl-local .bsl-panel { padding: 4px 18px 20px; }
}
@media (prefers-reduced-motion: reduce) {
#bsl-local *, #bsl-local *::before, #bsl-local *::after { transition: none !important; animation: none !important; }
}
Yes, local presence dialing can still raise answer rates, but less reliably than it used to, and only when the numbers behind it are clean. A local area code still helps a call get past the first glance. What it can no longer do on its own is beat a “Spam Likely” label, a weak STIR/SHAKEN attestation or a prospect who has learned to ignore every unknown number.
The pressure on cold calling is real. In Hiya’s State of the Call 2026 survey of more than 12,000 consumers in six countries, 86% said they do not answer calls from unidentified numbers.
This post looks at what the data says about local presence today, when it still works in an outbound dialer, when it backfires, and how caller ID management decides which of the two you get.
<p>Incoming call</p>
?
<p>(813) 555-0142</p>
<p>Tampa, FL</p>
<span></span>
<span></span><span></span>
<p>What your prospect sees</p>
<p>Choose a caller ID to see how the same call looks on a prospect’s phone in Denver.</p>
Out of state
Local number
Flagged local
Branded
<p><strong>13%</strong>said they were likely to answer an unknown out-of-state number in a 2014 Software Advice survey.</p>
What Is Local Presence Dialing in an Outbound Dialer?
Local presence dialing is an outbound dialer feature that shows a caller ID with the same area code as the person being called. A rep in Tampa dials a prospect in Denver, and the prospect sees a 303 or 720 number instead of an 813 one.
How a local presence dialer works
The auto dialer holds a pool of phone numbers across many area codes. For each outbound call, it reads the prospect’s number, picks the closest match from the pool, and sends that as the caller ID. If the prospect calls back, the call routes to the rep or team that dialed.
Local presence vs branded caller ID
The two solve different problems. Local presence changes the digits on the screen. Branded caller ID adds your business name, and on some phones a logo and call reason, next to the number. CNAM is the older text-only version, a short caller name stored with the number. Many sales teams now use local presence and branded caller ID together.
Does Local Presence Still Raise Answer Rates? What the Data Shows
The honest answer is that the evidence is mixed, and most of the big numbers are older than they look.
The classic “four times more likely” figure
The statistic quoted most often comes from a 2014 Software Advice survey of people asked how likely they were to answer an unknown call:
Local area code27.5%
Out-of-state area code13%
Toll-free number7%
Bars scaled to 30%. Source: Software Advice, 2014.
The same survey found 41% said they would hang up if they discovered a business was using local presence.
Newer call data is less impressive
Orum analyzed more than 1.5 million sales calls in 2021 and found a 4.6% connect rate for local presence calls against 5.5% for non-local calls, concluding local presence had no meaningful positive effect. Nooks reported little to no correlation between local presence and connect rates across 1.5 million dials in 2023.
Identity now matters more than area code
The stronger recent signal is caller identity. In a Twilio study of about 720,000 calls, branded calls were answered 62% of the time against 20% for unbranded calls from the same traffic. In Hiya’s 2026 survey, 73% of consumers said businesses should identify themselves on caller ID.
Why the effect has faded
Scammers adopted neighbor spoofing, so a local number no longer signals a local caller. Many people also keep their mobile number after moving, which weakens the link between area code and location. And carriers now judge numbers by reputation and STIR/SHAKEN attestation, not by area code.
When Local Presence Dialing Still Works for an Auto Dialer
Local presence tends to help in four situations.
The business really is local
A multi-location company calling from the real number of its nearest branch gets the full benefit. The number is local because the business is. This is the strongest case for local presence.
Consumer calling to mobile phones
Homeowners and consumers screen unknown mobile calls hardest, and a familiar area code is one of the few signals they see before deciding. Solar, home services, insurance and real estate teams calling consumers usually see more benefit than B2B teams calling office lines.
Clean, owned numbers with low daily volume
Local presence works when each number in the pool is owned, registered and used at a moderate pace. A clean local number beats a clean out-of-state number; a flagged local number loses to both.
First touch on a cold list
The area code matters most on the first call, before the prospect knows who you are. After a voicemail or email, a consistent number the prospect can recognize often works better than a new local one each time.
When Local Presence Dialing Backfires
Local presence can lower results as easily as it raises them.
Large rented pools that burn out
A common setup rotates through hundreds of rented numbers at high volume. It often performs for a few weeks, then numbers collect spam labels faster than they can be replaced, and answer rates fall week after week.
Prospects who feel tricked
A prospect who answers a “local” call and hears a national sales pitch may feel misled. That shows up as short calls and lost trust, even when the answer rate looks good. Measure call length and meetings booked, not just pickups.
Callbacks that go nowhere
If a prospect calls a local number back and reaches nothing, an unrelated business or a dead line, you lose the lead and the number’s reputation suffers.
Weak STIR/SHAKEN attestation
Carriers use STIR/SHAKEN to check that a caller is authorized to use the number shown. Numbers your provider cannot fully verify may get lower attestation, which raises the chance of a spam label and cancels out the area-code advantage.
Is Local Presence Dialing Legal?
Local presence dialing is legal in the U.S. when it is done with real numbers for honest purposes.
General information, not legal advice. Have counsel review your local presence setup before you scale it across states.
The Truth in Caller ID Act
The Truth in Caller ID Act makes it illegal to transmit misleading or inaccurate caller ID with the intent to defraud, cause harm or wrongfully obtain anything of value. Local presence stays on the right side of that line when the numbers are owned or leased by your business, are valid, and can take callbacks.
TCPA and Do Not Call rules still apply
Changing the caller ID does not change who you may call. Telephone Consumer Protection Act (TCPA) consent rules, the National Do Not Call Registry, and calling hours of 8 a.m. to 9 p.m. in the prospect’s local time all still apply.
Check state rules
Some states have their own caller ID and telemarketing laws, so review each state you call into.
Caller ID Management: Making Local Presence Work in an AI Dialer
Local presence is now a caller ID management job, not a switch you turn on. These practices decide whether it helps.
- Own every number in the pool. Use valid numbers registered to your business, never borrowed or random ones.
- Register your numbers and caller name. Submit numbers to the carrier analytics providers and set CNAM so your business name can display.
- Cap daily calls per number. Spreading volume across more numbers lowers the chance of spam labels.
- Monitor reputation and retire flagged numbers. Check for “Spam Likely” and “Scam Likely” labels regularly and pull flagged numbers out of rotation.
- Answer every callback. Route returned calls to the rep or team that dialed, and play a clear greeting.
- Add branded caller ID where possible. A verified business name builds more trust than an area code alone.
- Test, don’t assume. Run local presence on half of a list and your standard number on the other half for two weeks. Compare answer rate, call length and meetings booked.
How an AI dialer helps
An AI dialer can pick the best number for each call based on area code and reputation, detect voicemail automatically, and track answer rates by number so you can see which ones are wearing out.
BelSmart: Outbound Dialer With Local Presence and Caller ID Management
BelSmart is a cloud-based outbound dialer that pairs local presence dialing with caller ID management and spam-label remediation, so calls are less likely to show up as “Spam Likely”. BelSmart reports that local presence lifts answer rates by 30% to 40% on cold calling campaigns.
- Local presence dialing that matches caller ID to the prospect’s area code
- Number reputation monitoring with flagged numbers rotated out
- Four dialing modes (Manual, Preview, Power and Parallel) on one account
- AI answering machine detection and automatic voicemail drop
- TCPA tools including DNC scrubbing, consent tracking and calling-window enforcement
- CRM integration with HubSpot, Salesforce, Zoho CRM, Pipedrive and Freshsales
- Click-to-call from any CRM with the BelSmart Chrome extension
<p>Test local presence free for 7 days</p>
<p>Run your own split test: half a list on local presence, half on your standard number, and compare the results. Sign up yourself in minutes. No credit card required.</p>
<a href="https://account.belsmart.io/signup">Start your 7-day free trial</a>
Local Presence Dialing FAQ
Does local presence dialing still work?
<p>It can, but results vary. Older surveys show a large lift, while some recent studies of millions of sales calls found little or no difference. It works best with clean, owned numbers and a business that is genuinely local to the prospect.</p>
Is local presence dialing legal?
<p>Yes, in the U.S., when you use valid numbers your business owns or leases and that accept callbacks. Spoofing caller ID with intent to defraud or cause harm is illegal under the Truth in Caller ID Act.</p>
Why do my local presence numbers show as Spam Likely?
<p>Usually because of high call volume per number, low answer rates, consumer complaints or weak STIR/SHAKEN attestation. Spread calls across more numbers and monitor each one’s reputation.</p>
Is branded caller ID better than local presence?
<p>They do different jobs. Local presence changes the number; branded caller ID shows your business name. Recent data suggests identity has a bigger effect on answer rates, and many teams use both.</p>
Which outbound dialers include local presence?
<p>Most modern auto dialers and AI dialers offer it. Look for one that also monitors number reputation and replaces flagged numbers, since that decides whether local presence keeps working.</p>
The Bottom Line: Local Presence Works When Your Caller ID Is Trusted
Local presence dialing is no longer a guaranteed answer-rate boost. It still helps on clean numbers, for genuinely local businesses and on first-touch consumer calls, but spam labels and caller identity now matter more than the area code. Treat local presence as one part of caller ID management, test it against your standard number, and judge it by meetings booked rather than pickups alone.
Sources
- Hiya, State of the Call 2026 findings
- Software Advice, local presence dialing survey
- Orum, does local presence dialing impact connect rates?
- Nooks, should your team be using local presence?
- Aloware, summary of Twilio’s branded calling study
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{"@type": "Question", "name": "Does local presence dialing still work?", "acceptedAnswer": {"@type": "Answer", "text": "It can, but results vary. Older surveys show a large lift, while some recent studies of millions of sales calls found little or no difference. It works best with clean, owned numbers and a business that is genuinely local to the prospect."}},
{"@type": "Question", "name": "Is local presence dialing legal?", "acceptedAnswer": {"@type": "Answer", "text": "Yes, in the U.S., when you use valid numbers your business owns or leases and that accept callbacks. Spoofing caller ID with intent to defraud or cause harm is illegal under the Truth in Caller ID Act."}},
{"@type": "Question", "name": "Why do my local presence numbers show as Spam Likely?", "acceptedAnswer": {"@type": "Answer", "text": "Usually because of high call volume per number, low answer rates, consumer complaints or weak STIR/SHAKEN attestation. Spread calls across more numbers and monitor each one’s reputation."}},
{"@type": "Question", "name": "Is branded caller ID better than local presence?", "acceptedAnswer": {"@type": "Answer", "text": "They do different jobs. Local presence changes the number; branded caller ID shows your business name. Recent data suggests identity has a bigger effect on answer rates, and many teams use both."}},
{"@type": "Question", "name": "Which outbound dialers include local presence?", "acceptedAnswer": {"@type": "Answer", "text": "Most modern auto dialers and AI dialers offer it. Look for one that also monitors number reputation and replaces flagged numbers, since that decides whether local presence keeps working."}}
]
}
(function () {
var root = document.getElementById('bsl-local');
if (!root) return;
var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
/* Caller ID demo */
var states = {
outstate: { avatar: '?', name: '(813) 555-0142', sub: 'Tampa, FL', badge: '',
caption: '<strong>13%</strong>said they were likely to answer an unknown out-of-state number in a 2014 Software Advice survey.' },
local: { avatar: '?', name: '(303) 555-0187', sub: 'Denver, CO', badge: '',
caption: '<strong>27.5%</strong>said they were likely to answer an unknown local number in the same survey. Newer call data shows a much smaller gap.' },
spam: { avatar: '!', name: '(303) 555-0187', sub: 'Denver, CO', badge: 'Spam Likely',
caption: '<strong>Area code cancelled out</strong>Once a number is labeled, a local area code no longer helps. This is why number reputation matters most.' },
branded: { avatar: 'S', name: 'Sunline Solar', sub: 'Your quote is ready', badge: '✓ Verified business',
caption: '<strong>62% vs 20%</strong>Branded calls were answered 62% of the time against 20% for unbranded calls in a Twilio study of about 720,000 calls.' }
};
var screen = root.querySelector('.bsl-screen');
var swaps = root.querySelectorAll('.bsl-demo .bsl-swap');
var caption = root.querySelector('.bsl-caption');
var tabs = root.querySelectorAll('.bsl-tab');
var timer;
function show(key) {
var s = states[key];
tabs.forEach(function (t) { t.setAttribute('aria-selected', t.getAttribute('data-state') === key ? 'true' : 'false'); });
swaps.forEach(function (el) { el.classList.add('is-out'); });
clearTimeout(timer);
timer = setTimeout(function () {
screen.setAttribute('data-state', key);
screen.querySelector('[data-field="avatar"]').textContent = s.avatar;
screen.querySelector('[data-field="name"]').textContent = s.name;
screen.querySelector('[data-field="sub"]').textContent = s.sub;
screen.querySelector('[data-field="badge"]').textContent = s.badge;
caption.innerHTML = s.caption;
swaps.forEach(function (el) { el.classList.remove('is-out'); });
screen.classList.remove('is-ringing');
void screen.offsetWidth;
screen.classList.add('is-ringing');
}, reduce ? 0 : 280);
}
tabs.forEach(function (t, i) {
t.addEventListener('click', function () { show(t.getAttribute('data-state')); });
t.addEventListener('keydown', function (e) {
if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return;
var next = tabs[(i + (e.key === 'ArrowRight' ? 1 : tabs.length - 1)) % tabs.length];
next.focus(); show(next.getAttribute('data-state'));
});
});
/* Survey bars grow once when they scroll into view */
var bars = root.querySelector('[data-bars]');
function fillBars() {
bars.querySelectorAll('.bsl-fill').forEach(function (f) {
f.style.width = (parseFloat(f.getAttribute('data-value')) / 30 * 100) + '%';
});
}
if ('IntersectionObserver' in window && !reduce) {
var io = new IntersectionObserver(function (entries) {
if (entries[0].isIntersecting) { fillBars(); io.disconnect(); }
}, { threshold: 0.4 });
io.observe(bars);
} else {
fillBars();
}
/* FAQ accordion */
root.querySelectorAll('.bsl-faq-q').forEach(function (q) {
q.addEventListener('click', function () {
var open = q.getAttribute('aria-expanded') === 'true';
q.setAttribute('aria-expanded', open ? 'false' : 'true');
document.getElementById(q.getAttribute('aria-controls')).classList.toggle('is-open', !open);
});
});
/* Reading progress */
var bar = root.querySelector('.bsl-progress');
var ticking = false;
function onScroll() {
if (ticking) return;
ticking = true;
requestAnimationFrame(function () {
var r = root.getBoundingClientRect();
var total = r.height - window.innerHeight;
var p = total > 0 ? Math.min(Math.max(-r.top / total, 0), 1) : 1;
bar.style.transform = 'scaleX(' + p + ')';
ticking = false;
});
}
window.addEventListener('scroll', onScroll, { passive: true });
window.addEventListener('resize', onScroll);
onScroll();
})();
`
Top comments (0)