Day or night, we are here 7 days a week, including holidays.
“211 is the most comprehensive, up-to-date, easy-to-use service I have ever encountered. I tell everyone who has a need in DuPage County to access this service!”
Heather Britton, McKinney-Vento Student Advocate, DuPage Regional Office of Education
“I am grateful for 211 of DuPage. Thank you.”
Anonymous Caller
“211 does a great job helping people in a pinch that need help.”
Anonymous
“The 211 program is a game changer. I know personally that folks that we have referred to this valuable resource line are getting really timely and detailed information to help address their needs.”
Kathleen MacNamara, Social Worker, Village of Carol Stream
“I really do appreciate the help I needed it.”
Anonymous Caller
“The caller told me she was glad I answered and that she felt she got the resource help and ‘counseling’ all on the same call.”
Phyllis, Call Specialist, 211 DuPage
“The team is a true lifeline, offering assistance and support to those who need it the most. Thank you for being there with compassion and resources and guidance, especially during challenging times. The work you guys do truly makes a difference, and I am incredibly thankful for your dedication.”
Greg Schwarze, Chairman of Health and Human Services Committee, DuPage County
“I don’t remember how I heard about 211, but you always help me.”
The Illinois Office to Prevent and End Homelessness is partnering with communities throughout Illinois to gather input for the next Home Illinois Plan (July 2026 [...]
DuPage County Community Services Department, as administrator of the Energy Assistance Program in DuPage County, is pleased to announce that income-eligible households can now schedule [...]
.
*/
// -------- Config (optional) --------
var CONFIG = {
smoothScroll: true, // smooth scroll to first target
scrollOffset: 'auto', // number, or 'auto' to detect sticky header height
clickDelayMs: 200, // delay before clicking to open (allows layout settle)
retryAfterLoadMs: 300 // extra retry after full window load (lazy layouts)
};
// Detect sticky header height for offset (Avada uses various header wrappers)
function getAutoOffset() {
try {
var candidates = document.querySelectorAll(
'.fusion-header, .fusion-header-wrapper, #header, .fusion-sticky-container'
);
var maxH = 0;
candidates.forEach(function(el) {
var cs = window.getComputedStyle(el);
if (cs.position === 'fixed' || cs.position === 'sticky') {
var h = el.getBoundingClientRect().height;
if (h > maxH) maxH = h;
}
});
return maxH || 0;
} catch (e) { return 0; }
}
function getOffsetPx() {
if (CONFIG.scrollOffset === 'auto') return getAutoOffset();
var n = Number(CONFIG.scrollOffset);
return isNaN(n) ? 0 : n;
}
// Parse IDs from hash and query string
function getTargetIds() {
var ids = [];
// --- From hash ---
var rawHash = window.location.hash ? decodeURIComponent(window.location.hash.substring(1)) : '';
if (rawHash) {
// If hash looks like key=value (e.g., #open=toggle-1,toggle-3), use the value
var kv = rawHash.split('=');
if (kv.length === 2) {
ids = ids.concat(kv[1].split(',').map(function(s) { return s.trim(); }));
} else {
// Otherwise treat as ID or comma-list
ids = ids.concat(rawHash.split(',').map(function(s) { return s.trim(); }));
}
}
// --- From query params ---
var params = new URLSearchParams(window.location.search);
// Collect repeat values (?toggle=a&toggle=b)
var toggleParams = params.getAll('toggle').concat(params.getAll('open'));
toggleParams.forEach(function(v) {
v.split(',').forEach(function(item) { ids.push(item.trim()); });
});
// Deduplicate & sanitize
var seen = new Set();
ids = ids.filter(function(id) {
return id && !seen.has(id) && (seen.add(id), true);
});
return ids;
}
// Find the clickable header for a given toggle root
function findToggleHeader(root) {
if (!root) return null;
// If the ID was placed directly on the clickable title
var headingMatch = root.matches('.fusion-toggle-heading, .toggle-title, .panel-title a, .accordion .card-header a');
if (headingMatch) return root;
// Common Avada headings inside a toggle/accordion item
var selectors = [
'.fusion-toggle-heading',
'.toggle-title',
'.panel-title a',
'.fusion-accordion .panel-title a',
'.accordion .card-header a',
'a[aria-controls]',
'[data-toggle="collapse"]'
];
for (var i = 0; i < selectors.length; i++) {
var h = root.querySelector(selectors[i]);
if (h) return h;
}
// If the ID is on content, find a nearby header via wrapper
var wrapper = root.closest('.fusion-toggle, .fusion-accordion, .accordion, .panel, .fusion-panel');
if (wrapper) {
for (var j = 0; j < selectors.length; j++) {
var hh = wrapper.querySelector(selectors[j]);
if (hh) return hh;
}
}
// Last resort: heading linked by href="#id"
var byHref = document.querySelector('a[href="#' + CSS.escape(root.id) + '"]');
if (byHref) return byHref;
return null;
}
// Determine if header's associated panel is open
function isOpen(headerEl) {
if (!headerEl) return false;
// ARIA expanded is most reliable
var expanded = headerEl.getAttribute('aria-expanded');
if (expanded === 'true') return true;
// If header controls a panel, check that panel state
var controlsId = headerEl.getAttribute('aria-controls');
if (controlsId) {
var panel = document.getElementById(controlsId);
if (panel && (panel.classList.contains('show') || panel.classList.contains('in'))) return true;
}
// Check common wrapper "open" classes
var wrapper = headerEl.closest('.fusion-toggle, .panel, .fusion-panel');
if (wrapper && (
wrapper.classList.contains('fusion-active') ||
wrapper.classList.contains('active') ||
wrapper.classList.contains('open') ||
wrapper.classList.contains('in') ||
wrapper.classList.contains('show')
)) return true;
return false;
}
// Smooth/instant scroll to element with offset
function scrollIntoViewSmart(el) {
if (!el) return;
var offset = getOffsetPx();
// If native smooth scroll fails, fall back to manual
try {
var behavior = CONFIG.smoothScroll ? 'smooth' : 'auto';
// Scroll to top of element; offset handled via manual adjustment
var top = el.getBoundingClientRect().top + window.pageYOffset - offset;
window.scrollTo({ top: top, behavior: behavior });
} catch (e) {
window.scrollTo(0, el.getBoundingClientRect().top + window.pageYOffset - offset);
}
// Optional accessibility focus
setTimeout(function() {
try { el.setAttribute('tabindex', '-1'); el.focus({ preventScroll: true }); } catch (e) {}
}, 250);
}
// Open one toggle by id (if found)
function openToggleById(id) {
var target = document.getElementById(id);
if (!target) return { id: id, found: false, opened: false, scrolled: false };
var header = findToggleHeader(target);
// If header still not found, attempt nearby sibling/parent heuristics
if (!header) {
var sibs = [target.previousElementSibling, target.nextElementSibling, target.parentElement];
for (var i = 0; i < sibs.length && !header; i++) {
var s = sibs[i];
if (!s) continue;
header = findToggleHeader(s);
}
}
// Click to open if closed
var opened = false;
if (header && !isOpen(header)) {
header.click();
opened = true;
}
return { id: id, found: true, opened: opened, scrolled: false, element: target };
}
// Orchestrate opening multiple IDs and scroll to the first one
function openTargets(ids) {
if (!ids || !ids.length) return;
var results = [];
var firstEl = null;
// First pass: identify elements and queue opening
ids.forEach(function(id) {
var res = openToggleById(id);
results.push(res);
if (!firstEl && res.found) firstEl = res.element;
});
// Scroll to the first matched element
if (firstEl) {
scrollIntoViewSmart(firstEl);
results.forEach(function(r) { if (r.found) r.scrolled = (r.element === firstEl); });
}
// Optional: expose for debugging
window.__avadaToggleResults = results;
}
// Main runner
function run() {
var ids = getTargetIds();
if (!ids.length) return;
// Small delay allows Avada to finish layout/render (esp. accordions)
setTimeout(function() { openTargets(ids); }, CONFIG.clickDelayMs);
}
// Run at appropriate times
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', run);
} else {
run();
}
window.addEventListener('hashchange', run);
window.addEventListener('load', function() {
setTimeout(run, CONFIG.retryAfterLoadMs);
});
})();
Go to Top