1/** 2* Template Name: Anyar 3* Template URL: https://bootstrapmade.com/anyar-free-multipurpose-one-page-bootstrap-theme/ 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 * Init swiper sliders 107 */ 108 function initSwiper() { 109 document.querySelectorAll(".init-swiper").forEach(function(swiperElement) { 110 let config = JSON.parse( 111 swiperElement.querySelector(".swiper-config").innerHTML.trim() 112 ); 113 114 if (swiperElement.classList.contains("swiper-tab")) { 115 initSwiperWithCustomPagination(swiperElement, config); 116 } else { 117 new Swiper(swiperElement, config); 118 } 119 }); 120 } 121 122 window.addEventListener("load", initSwiper); 123 124 /** 125 * Initiate glightbox 126 */ 127 const glightbox = GLightbox({ 128 selector: '.glightbox' 129 }); 130 131 /** 132 * Init isotope layout and filters 133 */ 134 document.querySelectorAll('.isotope-layout').forEach(function(isotopeItem) { 135 let layout = isotopeItem.getAttribute('data-layout') ?? 'masonry'; 136 let filter = isotopeItem.getAttribute('data-default-filter') ?? '*'; 137 let sort = isotopeItem.getAttribute('data-sort') ?? 'original-order'; 138 139 let initIsotope; 140 imagesLoaded(isotopeItem.querySelector('.isotope-container'), function() { 141 initIsotope = new Isotope(isotopeItem.querySelector('.isotope-container'), { 142 itemSelector: '.isotope-item', 143 layoutMode: layout, 144 filter: filter, 145 sortBy: sort 146 }); 147 }); 148 149 isotopeItem.querySelectorAll('.isotope-filters li').forEach(function(filters) { 150 filters.addEventListener('click', function() { 151 isotopeItem.querySelector('.isotope-filters .filter-active').classList.remove('filter-active'); 152 this.classList.add('filter-active'); 153 initIsotope.arrange({ 154 filter: this.getAttribute('data-filter') 155 }); 156 if (typeof aosInit === 'function') { 157 aosInit(); 158 } 159 }, false); 160 }); 161 162 }); 163 164 /** 165 * Frequently Asked Questions Toggle 166 */ 167 document.querySelectorAll('.faq-item h3, .faq-item .faq-toggle').forEach((faqItem) => { 168 faqItem.addEventListener('click', () => { 169 faqItem.parentNode.classList.toggle('faq-active'); 170 }); 171 }); 172 173})();
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.