/** * demo.js * http://www.codrops.com * * Licensed under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Copyright 2017, Codrops * http://www.codrops.com */ { setTimeout(() => document.body.classList.add('render'), 60); const navdemos = Array.from(document.querySelectorAll('nav.demos > .demo')); const total = navdemos.length; const current = navdemos.findIndex(el => el.classList.contains('demo--current')); const navigate = (linkEl) => { document.body.classList.remove('render'); document.body.addEventListener('transitionend', () => window.location = linkEl.href); }; navdemos.forEach(link => link.addEventListener('click', (ev) => { ev.preventDefault(); navigate(ev.target); })); }