UNPKG

showcar-ui

Version:

Showcar-ui is the pattern library that is used to build the frontend of AutoScout24. It provides CSS classes, custom elements and components.

22 lines (18 loc) 633 B
export default () => { const handleClick = (collapsable) => { let targetAttr = collapsable.getAttribute('data-target'); let targets = document.querySelectorAll(targetAttr); Array.prototype.forEach.call(targets, (target) => { target.classList.toggle('in'); }); }; window.addEventListener('click', (e => { let target = e.target; while(target) { if (target.getAttribute && target.getAttribute('data-toggle') === 'sc-collapse') { return handleClick(target); } target = target.parentNode; } })); };