1/** 2* Template Name: TheEvent 3* Template URL: https://bootstrapmade.com/theevent-conference-event-bootstrap-template/ 4* Updated: Aug 07 2024 with Bootstrap v5.3.3 5* Author: BootstrapMade.com 6* License: https://bootstrapmade.com/license/ 7*/ 8 9(function() { 10 "use strict"; 11 12 /** 13 * Apply .scrolled class to the body as the page is scrolled down 14 */ 15 function toggleScrolled() { 16 const selectBody = document.querySelector('body'); 17 const selectHeader = document.querySelector('#header'); 18 if (!selectHeader.classList.contains('scroll-up-sticky') && !selectHeader.classList.contains('sticky-top') && !selectHeader.classList.contains('fixed-top')) return; 19 window.scrollY > 100 ? selectBody.classList.add('scrolled') : selectBody.classList.remove('scrolled'); 20 } 21 22 document.addEventListener('scroll', toggleScrolled); 23 window.addEventListener('load', toggleScrolled); 24 25 /** 26 * Mobile nav toggle 27 */ 28 const mobileNavToggleBtn = document.querySelector('.mobile-nav-toggle'); 29 30 function mobileNavToogle() { 31 document.querySelector('body').classList.toggle('mobile-nav-active'); 32 mobileNavToggleBtn.classList.toggle('bi-list'); 33 mobileNavToggleBtn.classList.toggle('bi-x'); 34 } 35 mobileNavToggleBtn.addEventListener('click', mobileNavToogle); 36 37 /** 38 * Hide mobile nav on same-page/hash links 39 */ 40 document.querySelectorAll('#navmenu a').forEach(navmenu => { 41 navmenu.addEventListener('click', () => { 42 if (document.querySelector('.mobile-nav-active')) { 43 mobileNavToogle(); 44 } 45 }); 46 47 }); 48 49 /** 50 * Toggle mobile nav dropdowns 51 */ 52 document.querySelectorAll('.navmenu .toggle-dropdown').forEach(navmenu => { 53 navmenu.addEventListener('click', function(e) { 54 e.preventDefault(); 55 this.parentNode.classList.toggle('active'); 56 this.parentNode.nextElementSibling.classList.toggle('dropdown-active'); 57 e.stopImmediatePropagation(); 58 }); 59 }); 60 61 /** 62 * Preloader 63 */ 64 const preloader = document.querySelector('#preloader'); 65 if (preloader) { 66 window.addEventListener('load', () => { 67 preloader.remove(); 68 }); 69 } 70 71 /** 72 * Scroll top button 73 */ 74 let scrollTop = document.querySelector('.scroll-top'); 75 76 function toggleScrollTop() { 77 if (scrollTop) { 78 window.scrollY > 100 ? scrollTop.classList.add('active') : scrollTop.classList.remove('active'); 79 } 80 } 81 scrollTop.addEventListener('click', (e) => { 82 e.preventDefault(); 83 window.scrollTo({ 84 top: 0, 85 behavior: 'smooth' 86 }); 87 }); 88 89 window.addEventListener('load', toggleScrollTop); 90 document.addEventListener('scroll', toggleScrollTop); 91 92 /** 93 * Animation on scroll function and init 94 */ 95 function aosInit() { 96 AOS.init({ 97 duration: 600, 98 easing: 'ease-in-out', 99 once: true, 100 mirror: false 101 }); 102 } 103 window.addEventListener('load', aosInit); 104 105 /** 106 * Initiate glightbox 107 */ 108 const glightbox = GLightbox({ 109 selector: '.glightbox' 110 }); 111 112 /** 113 * Init swiper sliders 114 */ 115 function initSwiper() { 116 document.querySelectorAll(".init-swiper").forEach(function(swiperElement) { 117 let config = JSON.parse( 118 swiperElement.querySelector(".swiper-config").innerHTML.trim() 119 ); 120 121 if (swiperElement.classList.contains("swiper-tab")) { 122 initSwiperWithCustomPagination(swiperElement, config); 123 } else { 124 new Swiper(swiperElement, config); 125 } 126 }); 127 } 128 129 window.addEventListener("load", initSwiper); 130 131 /** 132 * Frequently Asked Questions Toggle 133 */ 134 document.querySelectorAll('.faq-item h3, .faq-item .faq-toggle').forEach((faqItem) => { 135 faqItem.addEventListener('click', () => { 136 faqItem.parentNode.classList.toggle('faq-active'); 137 }); 138 }); 139 140 /** 141 * Correct scrolling position upon page load for URLs containing hash links. 142 */ 143 window.addEventListener('load', function(e) { 144 if (window.location.hash) { 145 if (document.querySelector(window.location.hash)) { 146 setTimeout(() => { 147 let section = document.querySelector(window.location.hash); 148 let scrollMarginTop = getComputedStyle(section).scrollMarginTop; 149 window.scrollTo({ 150 top: section.offsetTop - parseInt(scrollMarginTop), 151 behavior: 'smooth' 152 }); 153 }, 100); 154 } 155 } 156 }); 157 158 /** 159 * Navmenu Scrollspy 160 */ 161 let navmenulinks = document.querySelectorAll('.navmenu a'); 162 163 function navmenuScrollspy() { 164 navmenulinks.forEach(navmenulink => { 165 if (!navmenulink.hash) return; 166 let section = document.querySelector(navmenulink.hash); 167 if (!section) return; 168 let position = window.scrollY + 200; 169 if (position >= section.offsetTop && position <= (section.offsetTop + section.offsetHeight)) { 170 document.querySelectorAll('.navmenu a.active').forEach(link => link.classList.remove('active')); 171 navmenulink.classList.add('active'); 172 } else { 173 navmenulink.classList.remove('active'); 174 } 175 }) 176 } 177 window.addEventListener('load', navmenuScrollspy); 178 document.addEventListener('scroll', navmenuScrollspy); 179 180})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.