1// =================== header js start here =================== 2// Add class 'menu-item-has-children' to parent li elements of '.submenu' 3var submenuList = document.querySelectorAll("ul>li>.submenu"); 4submenuList.forEach(function (submenu) { 5 var parentLi = submenu.parentElement; 6 if (parentLi) { 7 parentLi.classList.add("menu-item-has-children"); 8 } 9}); 10 11// Fix dropdown menu overflow problem 12var menuList = document.querySelectorAll("ul"); 13menuList.forEach(function (menu) { 14 var parentLi = menu.parentElement; 15 if (parentLi) { 16 parentLi.addEventListener("mouseover", function () { 17 var menuPos = menu.getBoundingClientRect(); 18 if (menuPos.left + menu.offsetWidth > window.innerWidth) { 19 menu.style.left = -menu.offsetWidth + "px"; 20 } 21 }); 22 } 23}); 24 25 26 27// Toggle menu on click 28 29var menuLinks = document.querySelectorAll(".menu li a"); 30 31menuLinks.forEach(function (link) { 32 link.addEventListener("click", function (e) { 33 e.stopPropagation(); // prevent the event from bubbling up to parent elements 34 var element = link.parentElement; 35 if (parseInt(window.innerWidth, 10) < 1200) { 36 if (element.classList.contains("open")) { 37 element.classList.remove("open"); 38 element.querySelector("ul").style.display = "none"; 39 } else { 40 element.classList.add("open"); 41 element.querySelector("ul").style.display = "block"; 42 } 43 } 44 }); 45}); 46 47 48 49 50// Toggle header bar on click 51var headerBar = document.querySelector(".header-bar"); 52headerBar.addEventListener("click", function () { 53 headerBar.classList.toggle("active"); 54 var menu = document.querySelector(".menu"); 55 if (menu) { 56 menu.classList.toggle("active"); 57 } 58}); 59 60//Header 61var fixedTop = document.querySelector("header"); 62window.addEventListener("scroll", function () { 63 if (window.scrollY > 300) { 64 fixedTop.classList.add("header-fixed", "fadeInUp"); 65 } else { 66 fixedTop.classList.remove("header-fixed", "fadeInUp"); 67 } 68}); 69 70 71// =================== header js end here =================== // 72 73/*============================================= 74 = Preloader JS = 75=============================================*/ 76window.addEventListener('load', function () { 77 var preloader = document.querySelector('.preloader'); 78 if (preloader) { 79 preloader.style.transition = 'opacity .3s ease'; 80 preloader.style.opacity = '0'; 81 setTimeout(function () { 82 preloader.style.display = 'none'; 83 }, 1500); 84 } 85}); 86 87 88// =================== Change image path start ================== // 89 90function changeImage(themeMode = 'light') { 91 92 const icon = document.querySelector('#btnSwitch img'); 93 94 95 if (themeMode === "dark") { 96 97 icon.src = 'assets/images/icon/sun.svg'; 98 var images = document.querySelectorAll('img.dark'); 99 100 for (var i = 0; i < images.length; i++) { 101 var oldSrc = images[i].src; 102 oldSrc = oldSrc.replace("-dark.", "."); 103 var oldIndex = oldSrc.lastIndexOf("."); 104 var baseName = oldSrc.slice(0, oldIndex); 105 var extension = oldSrc.slice(oldIndex); 106 var newSrc = baseName + "-dark" + extension; 107 images[i].src = newSrc; 108 } 109 } else { 110 icon.src = 'assets/images/icon/moon.svg'; 111 var images = document.querySelectorAll('img.dark'); 112 113 for (var i = 0; i < images.length; i++) { 114 var oldSrc = images[i].src; 115 var newSrc = oldSrc.replace("-dark.", "."); 116 images[i].src = newSrc; 117 } 118 } 119 120} 121 122 123// =================== Change image path end ================== // 124 125 126 127 128 129/*============================================= 130 = AOS Active = 131=============================================*/ 132AOS.init(); 133 134 135 136/*============================================= 137 = Counter Active = 138=============================================*/ 139new PureCounter(); 140 141 142/*============================================= 143 = Update Jquery = 144=============================================*/ 145(function ($) { 146 "use strict"; 147 148 149 150 // Show/hide button on scroll 151 window.addEventListener('scroll', function () { 152 var scrollToTop = document.querySelector('.scrollToTop'); 153 154 if (scrollToTop) { 155 if (window.pageYOffset > 300) { 156 scrollToTop.style.bottom = '7%'; 157 scrollToTop.style.opacity = '1'; 158 scrollToTop.style.transition = 'all .5s ease'; 159 } else { 160 scrollToTop.style.bottom = '-30%'; 161 scrollToTop.style.opacity = '0'; 162 scrollToTop.style.transition = 'all .5s ease'; 163 } 164 } 165 });
166 167 168 169 $(window).on('scroll', function () { 170 var scroll = $(window).scrollTop(); 171 if (scroll < 245) { 172 $('.scroll-to-target').removeClass('open'); 173 174 } else { 175 $('.scroll-to-target').addClass('open'); 176 } 177 }); 178 179 /*============================================= 180 = Scroll Up = 181 =============================================*/ 182 if ($('.scroll-to-target').length) { 183 $(".scroll-to-target").on('click', function () { 184 var target = $(this).attr('data-target'); 185 // animate 186 $('html, body').animate({ 187 scrollTop: $(target).offset().top 188 }, 1000); 189 190 }); 191 } 192 193 194 195 196 197 198 $('.blog-masonry-active').imagesLoaded(function () { 199 // init Isotope 200 var $grid = $('.blog-masonry-active').isotope({ 201 itemSelector: '.grid-item', 202 percentPosition: true, 203 masonry: { 204 columnWidth: 1, 205 } 206 }); 207 }); 208 209 $("[data-bg-color]").each(function () { 210 $(this).css("background-color", $(this).attr("data-bg-color")); 211 }); 212 213 $('.tp-product__filter select').niceSelect(); 214 215})(jQuery);
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.