1(function ($) { 2 "use strict"; 3 4 if ($(".sticky-header").length) { 5 $(".sticky-header") 6 .clone() 7 .insertAfter(".sticky-header") 8 .addClass("sticky-header--cloned"); 9 } 10 11 if ($(".main-menu__list").length) { 12 let menuElement = $(".main-menu__list"); 13 let currentMenuItem = menuElement.find("li.current-menu-item"); 14 let currentMenuParent = menuElement.find("li.current-menu-parent"); 15 let currentMenuAncestor = menuElement.find("li.current-menu-ancestor"); 16 let currentPageItem = menuElement.find("li.current_page_item"); 17 currentMenuItem.addClass("current"); 18 currentMenuParent.addClass("current"); 19 currentMenuAncestor.addClass("current"); 20 currentPageItem.addClass("current"); 21 } 22 23 if ($(".service-details__category-list").length) { 24 let menuElement = $(".service-details__category-list"); 25 let currentMenuItem = menuElement.find("li.current-menu-item"); 26 let currentMenuParent = menuElement.find("li.current-menu-parent"); 27 let currentMenuAncestor = menuElement.find("li.current-menu-ancestor"); 28 let currentPageItem = menuElement.find("li.current_page_item"); 29 currentMenuItem.addClass("active"); 30 currentMenuParent.addClass("active"); 31 currentMenuAncestor.addClass("active"); 32 currentPageItem.addClass("active"); 33 } 34 35 // Accrodion 36 if ($(".accrodion-grp").length) { 37 var accrodionGrp = $(".accrodion-grp"); 38 accrodionGrp.each(function () { 39 var accrodionName = $(this).data("grp-name"); 40 var Self = $(this); 41 var accordion = Self.find(".accrodion"); 42 Self.addClass(accrodionName); 43 Self.find(".accrodion .accrodion-content").hide(); 44 Self.find(".accrodion.active").find(".accrodion-content").show(); 45 accordion.each(function () { 46 $(this) 47 .find(".accrodion-title") 48 .on("click", function () { 49 if ($(this).parent().hasClass("active") === false) { 50 $(".accrodion-grp." + accrodionName) 51 .find(".accrodion") 52 .removeClass("active"); 53 $(".accrodion-grp." + accrodionName) 54 .find(".accrodion") 55 .find(".accrodion-content") 56 .slideUp(); 57 $(this).parent().addClass("active"); 58 $(this).parent().find(".accrodion-content").slideDown(); 59 } 60 }); 61 }); 62 }); 63 } 64 65 if ($(".scroll-to-target").length) { 66 $(".scroll-to-target").on("click", function () { 67 var target = $(this).attr("data-target"); 68 // animate 69 $("html, body").animate( 70 { 71 scrollTop: $(target).offset().top 72 }, 73 1000 74 ); 75 76 return false; 77 }); 78 } 79 80 if ($(".video-popup").length) { 81 $(".video-popup").magnificPopup({ 82 type: "iframe", 83 mainClass: "mfp-fade", 84 removalDelay: 160, 85 preloader: true, 86 87 fixedContentPos: false 88 }); 89 } 90 91 if ($(".img-popup").length) { 92 var groups = {}; 93 $(".img-popup").each(function () { 94 var id = parseInt($(this).attr("data-group"), 10); 95 96 if (!groups[id]) { 97 groups[id] = []; 98 } 99 100 groups[id].push(this); 101 }); 102 103 $.each(groups, function () { 104 $(this).magnificPopup({ 105 type: "image", 106 closeOnContentClick: true, 107 closeBtnInside: false, 108 gallery: { 109 enabled: true 110 } 111 }); 112 }); 113 } 114 115 $(document).on("click", ".add", function () { 116 if ($(this).prev().val() < 999) { 117 $(this) 118 .prev() 119 .val(+$(this).prev().val() + 1); 120 } 121 $(this).prev().trigger("change"); 122 }); 123 124 $(document).on("click", ".sub", function () { 125 if ($(this).next().val() > 0) { 126 if ($(this).next().val() > 0) 127 $(this) 128 .next() 129 .val(+$(this).next().val() - 1); 130 } 131 $(this).next().trigger("change"); 132 }); 133 134 if ($(".main-menu__list").length && $(".mobile-nav__container").length) { 135 let navContent = document.querySelector(".main-menu__list").outerHTML; 136 let mobileNavContainer = document.querySelector(".mobile-nav__container"); 137 mobileNavContainer.innerHTML = navContent; 138 } 139 if ($(".sticky-header__content").length) { 140 let navContent = document.querySelector(".main-menu").innerHTML; 141 let mobileNavContainer = document.querySelector(".sticky-header__content"); 142 mobileNavContainer.innerHTML = navContent; 143 } 144 145 if ($(".mobile-nav__container .main-menu__list").length) { 146 let dropdownAnchor = $( 147 ".mobile-nav__container .main-menu__list .menu-item-has-children > a" 148 ); 149 dropdownAnchor.each(function () { 150 let self = $(this); 151 let toggleBtn = document.createElement("BUTTON"); 152 toggleBtn.setAttribute("aria-label", "dropdown toggler"); 153 toggleBtn.innerHTML = "<i class='fa fa-angle-down'></i>"; 154 self.append(function () { 155 return toggleBtn; 156 }); 157 self.find("button").on("click", function (e) { 158 e.preventDefault(); 159 let self = $(this); 160 self.toggleClass("expanded"); 161 self.parent().toggleClass("expanded"); 162 self.parent().parent().children("ul").slideToggle(); 163 }); 164 });
165 } 166 167 if ($(".mobile-nav__toggler").length) { 168 $(".mobile-nav__toggler").on("click", function (e) { 169 e.preventDefault(); 170 $(".mobile-nav__wrapper").toggleClass("expanded"); 171 $("body").toggleClass("locked"); 172 }); 173 } 174 175 if ($(".search-toggler").length) { 176 $(".search-toggler").on("click", function (e) { 177 e.preventDefault(); 178 $(".search-popup").toggleClass("active"); 179 $(".mobile-nav__wrapper").removeClass("expanded"); 180 $("body").toggleClass("locked"); 181 }); 182 } 183 184 if ($(".dynamic-year").length) { 185 let date = new Date(); 186 $(".dynamic-year").html(date.getFullYear()); 187 } 188 189 trevlo_stretch(); 190 191 function trevlo_stretch() { 192 var i = $(window).width(); 193 $(".row .trevlo-stretch-element-inside-column").each(function () { 194 var $this = $(this), 195 row = $this.closest(".row"), 196 cols = $this.closest('[class^="col-"]'), 197 colsheight = $this.closest('[class^="col-"]').height(), 198 rect = this.getBoundingClientRect(), 199 l = row[0].getBoundingClientRect(), 200 s = cols[0].getBoundingClientRect(), 201 r = rect.left, 202 d = i - rect.right, 203 c = l.left + (parseFloat(row.css("padding-left")) || 0), 204 u = i - l.right + (parseFloat(row.css("padding-right")) || 0), 205 p = s.left, 206 f = i - s.right, 207 styles = { 208 "margin-left": 0, 209 "margin-right": 0 210 }; 211 if (Math.round(c) === Math.round(p)) { 212 var h = parseFloat($this.css("margin-left") || 0); 213 styles["margin-left"] = h - r; 214 } 215 if (Math.round(u) === Math.round(f)) { 216 var w = parseFloat($this.css("margin-right") || 0); 217 styles["margin-right"] = w - d; 218 } 219 $this.css(styles); 220 }); 221 } 222 223 // window load event 224 $(window).on("load", function () { 225 if ($(".preloader").length) { 226 $(".preloader").fadeOut(); 227 } 228 229 if ($(".product__items ul.products").length) { 230 $(".product__items ul.products").imagesLoaded(function () { 231 $(".product__items ul.products").isotope({ 232 layoutMode: "masonry" 233 }); 234 }); 235 } 236 }); 237 238 // window scroll event 239 function stickyMenuUpScroll($targetMenu, $toggleClass) { 240 var lastScrollTop = 0; 241 window.addEventListener( 242 "scroll", 243 function () { 244 var st = window.pageYOffset || document.documentElement.scrollTop; 245 if (st > 500) { 246 if (st > lastScrollTop) { 247 // downscroll code 248 $targetMenu.removeClass($toggleClass); 249 // console.log("down"); 250 } else { 251 // upscroll code 252 $targetMenu.addClass($toggleClass); 253 // console.log("up"); 254 } 255 } else { 256 $targetMenu.removeClass($toggleClass); 257 } 258 lastScrollTop = st; 259 }, 260 false 261 ); 262 } 263 stickyMenuUpScroll($(".sticky-header--normal"), "active"); 264 265 /*-- Handle Scrollbar --*/ 266 function handleScrollbar() { 267 const bodyHeight = $("body").height(); 268 const scrollPos = $(window).innerHeight() + $(window).scrollTop(); 269 let percentage = (scrollPos / bodyHeight) * 100; 270 if (percentage > 100) { 271 percentage = 100; 272 } 273 $(".scroll-to-top .scroll-to-top__inner").css("width", percentage + "%"); 274 } 275 276 function OnePageMenuScroll() { 277 var windscroll = $(window).scrollTop(); 278 if (windscroll >= 117) { 279 var menuAnchor = $(".one-page-scroll-menu .scrollToLink").children("a"); 280 menuAnchor.each(function () { 281 var sections = $(this).attr("href"); 282 $(sections).each(function () { 283 if ($(this).offset().top <= windscroll + 100) { 284 var Sectionid = $(sections).attr("id"); 285 $(".one-page-scroll-menu").find("li").removeClass("current"); 286 $(".one-page-scroll-menu") 287 .find("li") 288 .removeClass("current-menu-ancestor"); 289 $(".one-page-scroll-menu") 290 .find("li") 291 .removeClass("current_page_item"); 292 $(".one-page-scroll-menu") 293 .find("li") 294 .removeClass("current-menu-parent"); 295 $(".one-page-scroll-menu") 296 .find("a[href*=\\#" + Sectionid + "]") 297 .parent() 298 .addClass("current"); 299 } 300 }); 301 }); 302 } else { 303 $(".one-page-scroll-menu li.current").removeClass("current"); 304 $(".one-page-scroll-menu li:first").addClass("current"); 305 } 306 } 307 308 // window scroll event 309 310 $(window).on("scroll", function () { 311 OnePageMenuScroll(); 312 handleScrollbar(); 313 if ($(".sticky-header--one-page").length) { 314 var headerScrollPos = 130; 315 var stricky = $(".sticky-header--one-page"); 316 if ($(window).scrollTop() > headerScrollPos) {
317 stricky.addClass("active"); 318 } else if ($(this).scrollTop() <= headerScrollPos) { 319 stricky.removeClass("active"); 320 } 321 } 322 323 var scrollToTopBtn = ".scroll-to-top"; 324 if (scrollToTopBtn.length) { 325 if ($(window).scrollTop() > 500) { 326 $(scrollToTopBtn).addClass("show"); 327 } else { 328 $(scrollToTopBtn).removeClass("show"); 329 } 330 } 331 }); 332 333 $(document).on("click", ".shop-one__cart.trevlo_ajax ", function (e) { 334 $(".trevlo-overlay").fadeIn(300); 335 }); 336 337 $(document.body).on( 338 "added_to_cart", 339 function (event, fragments, cart_hash, $button) { 340 $(".trevlo-overlay").fadeOut(300); 341 } 342 ); 343 344 // custom coursor 345 if ($(".custom-cursor").length) { 346 var cursor = document.querySelector(".custom-cursor__cursor"); 347 var cursorinner = document.querySelector(".custom-cursor__cursor-two"); 348 var a = document.querySelectorAll("a"); 349 350 document.addEventListener("mousemove", function (e) { 351 var x = e.clientX; 352 var y = e.clientY; 353 cursor.style.transform = `translate3d(calc(${e.clientX}px - 50%), calc(${e.clientY}px - 50%), 0)`; 354 }); 355 356 document.addEventListener("mousemove", function (e) { 357 var x = e.clientX; 358 var y = e.clientY; 359 cursorinner.style.left = x + "px"; 360 cursorinner.style.top = y + "px"; 361 }); 362 363 document.addEventListener("mousedown", function () { 364 cursor.classList.add("click"); 365 cursorinner.classList.add("custom-cursor__innerhover"); 366 }); 367 368 document.addEventListener("mouseup", function () { 369 cursor.classList.remove("click"); 370 cursorinner.classList.remove("custom-cursor__innerhover"); 371 }); 372 373 a.forEach((item) => { 374 item.addEventListener("mouseover", () => { 375 cursor.classList.add("custom-cursor__hover"); 376 }); 377 item.addEventListener("mouseleave", () => { 378 cursor.classList.remove("custom-cursor__hover"); 379 }); 380 }); 381 } 382 383 //Show Popup menu 384 $(document).on("click", ".megamenu-clickable--toggler > a", function (e) { 385 $("body").toggleClass("megamenu-popup-active"); 386 $(this).parent().find("ul").toggleClass("megamenu-clickable--active"); 387 e.preventDefault(); 388 }); 389 $(document).on("click", ".megamenu-clickable--close", function (e) { 390 $("body").removeClass("megamenu-popup-active"); 391 $(".megamenu-clickable--active").removeClass("megamenu-clickable--active"); 392 e.preventDefault(); 393 }); 394 395 /*-- Back-to-top --*/ 396 let scrollTop = $(".scroll-top path"); 397 if (scrollTop.length) { 398 var e = document.querySelector(".scroll-top path"), 399 t = e.getTotalLength(); 400 (e.style.transition = e.style.WebkitTransition = "none"), 401 (e.style.strokeDasharray = t + " " + t), 402 (e.style.strokeDashoffset = t), 403 e.getBoundingClientRect(), 404 (e.style.transition = e.style.WebkitTransition = 405 "stroke-dashoffset 10ms linear"); 406 var o = function () { 407 var o = $(window).scrollTop(), 408 r = $(document).height() - $(window).height(), 409 i = t - (o * t) / r; 410 e.style.strokeDashoffset = i; 411 }; 412 o(), $(window).scroll(o); 413 var back = $(".scroll-top"), 414 body = $("body, html"); 415 $(window).on("scroll", function () { 416 if ($(window).scrollTop() > $(window).height()) { 417 back.addClass("scroll-top--active"); 418 } else { 419 back.removeClass("scroll-top--active"); 420 } 421 }); 422 } 423 424 425 /*-- Dynamic year --*/ 426 let dynamicyearElm = $(".dynamic-year"); 427 if (dynamicyearElm.length) { 428 let currentYear = new Date().getFullYear(); 429 dynamicyearElm.html(currentYear); 430 } 431 432 $(window).on('resize', function() { 433 trevlo_stretch(); 434 }); 435})(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.