PageSourceSearch

https://www.ahla.com/themes/custom/ahla_v2/assets/js/main.js?v=11.3.11

js ahla.com collected 2026-10-01 09:07:17 UTC 85,888 bytes, 2,461 lines download raw bytes

1(function ($) {
2  "use strict";
3
4  /****** Change variables value as per your need ******/
5  var menuBreakPoint = 991;
6  var sliderBreakPoint = 991; // It will effect when you have used attribute "data-thumb-slider-md-direction" OR "data-slider-md-direction"
7  var mobileAnimation = false;
8
9  /****** Don't change variables value ******/
10  var lastScroll = 0,
11    simpleDropdown = 0,
12    linkDropdown = 0,
13    isotopeObjs = [],
14    swiperObjs = [],
15    wow = "";
16
17  /****** Check for browser OS ******/
18  var isMobile = false,
19    isiPhoneiPad = false,
20    isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
21
22  if (
23    /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
24      navigator.userAgent,
25    )
26  ) {
27    isMobile = true;
28  }
29
30  if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
31    isiPhoneiPad = true;
32  }
33
34  /****** jQuery Appear ******/
35  $(
36    ".image-back-offset-shadow, .vertical-counter, .counter, .progress-bar, .pie-chart-style-01, .pie-chart-style-02",
37  ).each(function () {
38    $(this).appear().trigger("resize");
39  });
40
41  megaMenuOnResize();
42  animateCounters();
43  fullScreenHeight();
44  SetResizeContent();
45  setOverLayerPosition();
46  setBottomOverLayerPosition(2000);
47  initScrollNavigate();
48  stickyFooter();
49
50  /****** Swiper slider using params ******/
51  setupSwiper();
52  destroySwiperLoop();
53
54  /****** Fit videos ******/
55  $(".fit-videos").fitVids();
56
57  /* hamberger menu custom scrollbar */
58  $("[data-scroll-options]").each(function () {
59    var _this = $(this);
60    var scrollOptions =
61      _this.attr("data-scroll-options") || '{ "theme": "dark" }';
62    if (typeof scrollOptions !== "undefined" && scrollOptions !== null) {
63      scrollOptions = $.parseJSON(scrollOptions);
64      _this.mCustomScrollbar(scrollOptions);
65    }
66  });
67
68  /****** Video player in background ******/
69  $(document).on("click", ".html-video-play", function () {
70    var $videoBg = $(this).parents("section").find(".video-bg");
71    if ($(this).is("[playing]") === false) {
72      $videoBg.trigger("play");
73      $(this).attr("playing", "true");
74    } else {
75      $videoBg.trigger("pause");
76      $(this).removeAttr("playing");
77    }
78  });
79
80  /****** Range slider for price filter ******/
81  if ($(".price-filter").length > 0) {
82    $(".price-filter").slider({
83      range: true,
84      animate: true,
85      min: 0,
86      max: 4000,
87      step: 1,
88      values: [1, 3999],
89      slide: function (event, ui) {
90        $(".price-amount").val("$" + ui.values[0] + " - $" + ui.values[1]);
91        $(document.body).trigger("price_slider_change", [
92          ui.values[0],
93          ui.values[1],
94        ]);
95      },
96    });
97    $(".price-amount").val(
98      "$" +
99        $(".price-filter").slider("values", 0) +
100        " - $" +
101        $(".price-filter").slider("values", 1),
102    );
103  }
104
105  /****** Back Image shadow on jQuery appear ******/
106  if ($(".image-back-offset-shadow").length > 0) {
107    $(document).on("appear", ".image-back-offset-shadow", function (e) {
108      $(".image-back-offset-shadow").addClass("active");
109    });
110  }
111
112  /****** Vertical counter ******/
113  $(".vertical-counter").each(function () {
114    var _this = $(this),
115      counterValue = _this.attr("data-to"),
116      individualValue = counterValue.toString().split(""),
117      valueLength = counterValue.length;
118    //adding the div.vertical-counter-number in div.counter multiple(valueLength) times
119    for (var i = 0; i < valueLength; i++) {
120      _this.append(
121        '<span class="vertical-counter-number"><ul><li>0</li><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li></ul></span>',
122      );
123    }
124    //adding the individual data-to in each div.vertical-counter-number
125    _this.find(".vertical-counter-number").each(function (index) {
126      $(this).attr("data-to", individualValue[index]);
127    });
128  });
129
130  /****** Vertical counter on jQuery appear ******/
131  if ($(".vertical-counter").length > 0) {
132    $(document).on("appear", ".vertical-counter", function (e) {
133      if (
134        $(window).scrollTop() + getWindowHeight() >=
135        $(".vertical-counter").offset().top
136      ) {
137        $(this)
138          .find(".vertical-counter-number")
139          .each(function () {
140            var _this = $(this),
141              value = _this.attr("data-to"),
142              divHeight = _this.find("li").height();
143            _this.height(divHeight);
144            if (value <= 9) {
145              _this
146                .find("ul")
147                .css({ transform: "translateY(-" + value * 10 + "%)" });
148            }
149          });
150      }
151    });
152  }
153
154  /****** Counter number reset on jQuery appear ******/
155  if ($(".counter").length > 0) {
156    $(document).on("appear", ".counter", function (e) {
157      var _this = $(this);
158      if (!_this.hasClass("appear")) {
159        var options = _this.data("countToOptions") || {};
160        _this.countTo(options);
161        _this.addClass("appear");
162      }
163    });
164  }
165
166  /****** progress bar on jQuery appear ******/
167  if ($(".progress-bar").length > 0) {
168    $(document).on("appear", ".progress-bar", function (e) {
169      if (!$(this).hasClass("appear")) {
170        $(this).addClass("appear");
171        var total = $(this).attr("aria-valuenow"),
172          delay = 300;
173        $(this).animate(
174          { width: total + "%" },
175          {
176            duration: delay,
177            easing: "swing",
178            progress: function (animation, progress, msRemaining) {
179              var counter = parseInt(total * progress);
180              $(this)
181                .find("span")
182                .html(counter + "%");
183            },
184          },
185        );
186      }
187    });
188  }
189
190  /****** Pie charts style 01 on jQuery appear ******/
191  if ($(".pie-chart-style-01").length > 0) {
192    var color1, color2;
193    $(document.body).on("appear", ".pie-chart-style-01", function (e) {
194      $(".pie-chart-style-01").easyPieChart({
195        trackColor: "#232323",
196        scaleColor: "",
197        lineCap: "round",
198        lineWidth: 10,
199        size: 180,
200        barColor: function () {
201          color1 =
202            $(this.el).attr("data-start-color") ||
203            $(this.el).attr("data-bar-color") ||
204            "#000";
205          color2 =
206            $(this.el).attr("data-end-color") ||
207            $(this.el).attr("data-bar-color") ||
208            "#000";
209          var ctx = this.renderer.getCtx();
210          var canvas = this.renderer.getCanvas();
211          var gradient = ctx.createLinearGradient(0, 0, canvas.width, 270);
212          gradient.addColorStop(0.2, color1);
213          gradient.addColorStop(0, color2);
214          return gradient;
215        },
216        animate: {
217          duration: 2000,
218          enabled: true,
219        },
220        onStep: function (from, to, percent) {
221          $(this.el)
222            .find(".percent")
223            .text(Math.round(percent) + "%");
224        },
225      });
226    });
227  }
228
229  /****** Pie charts style 02 on jQuery appear ******/
230  if ($(".pie-chart-style-02").length > 0) {
231    var color1, color2;
232    $(document.body).on("appear", ".pie-chart-style-02", function (e) {
233      $(".pie-chart-style-02").easyPieChart({
234        trackColor: "#232323",
235        scaleColor: "",
236        lineCap: "round",
237        lineWidth: 10,
238        size: 140,
239        barColor: function () {
240          color1 =
241            $(this.el).attr("data-start-color") ||
242            $(this.el).attr("data-bar-color") ||
243            "#000";
244          color2 =
245            $(this.el).attr("data-end-color") ||
246            $(this.el).attr("data-bar-color") ||
247            "#000";
248          var ctx = this.renderer.getCtx();
249          var canvas = this.renderer.getCanvas();
250          var gradient = ctx.createLinearGradient(0, 0, canvas.width, 270);
251          gradient.addColorStop(0.2, color1);
252          gradient.addColorStop(0, color2);
253          return gradient;
254        },
255        animate: {
256          duration: 2000,
257          enabled: true,
258        },
259        onStep: function (from, to, percent) {
260          $(this.el)
261            .find(".percent")
262            .text(Math.round(percent) + "%");
263        },
264      });
265    });
266  }
267
268  /****** Plus quntity in single product page ******/
269  $(document).on("click", ".qty-plus", function (e) {
270    // Stop acting like a button
271    e.preventDefault();
272    // Get the field name
273    var fieldName = $(this).attr("data-field");
274    // Get its current value
275    var currentVal = parseInt(
276      $(this)
277        .closest(".quantity")
278        .find("input[name=" + fieldName + "]")
279        .val(),
280    );
281    // If is not undefined
282    if (!isNaN(currentVal)) {
283      // Increment
284      $(this)
285        .closest(".quantity")
286        .find("input[name= " + fieldName + "]")
287        .val(currentVal + 1);
288    } else {
289      // Otherwise put a 0 there
290      $(this)
291        .closest(".quantity")
292        .find("input[name=" + fieldName + "]")
293        .val(0);
294    }
295    // Trigger change value
296    $(this).closest(".quantity").find(".input-text").trigger("change");
297  });
298
299  /****** Minus quntity in single product page ******/
300  $(document).on("click", ".qty-minus", function (e) {
301    // Stop acting like a button
302    e.preventDefault();
303    // Get the field name
304    var fieldName = $(this).attr("data-field");
305    // Get its current value
306    var currentVal = parseInt(
307      $(this)
308        .closest(".quantity")
309        .find("input[name= " + fieldName + "]")
310        .val(),
311    );
312    // If it isn't undefined or its greater than 0
313    if (!isNaN(currentVal) && currentVal > 0) {
314      // Decrement one
315      $(this)
316        .closest(".quantity")
317        .find("input[name=" + fieldName + "]")
318        .val(currentVal - 1);
319    } else {
320      // Otherwise put a 0 there
321      $(this)
322        .closest(".quantity")
323        .find("input[name=" + fieldName + "]")
324        .val(0);
325    }
326    // Trigger change value
327    $(this).closest(".quantity").find(".input-text").trigger("change");
328  });
329
330  /****** Initialise tooltip *****/
331  if ($('[data-bs-toggle="tooltip"]').length > 0) {
332    $('[data-bs-toggle="tooltip"]').tooltip();
333  }
334
335  /****** Tilt effect using params ******/
336  if ($(".tilt-box").length > 0 && !isMobile) {
337    $(".tilt-box").each(function () {
338      var _this = $(this),
339        tiltOptions =
340          _this.attr("data-tilt-options") ||
341          '{ "maxTilt": 20, "perspective": 1000, "easing": "cubic-bezier(.03,.98,.52,.99)", "scale": 1, "speed": 500, "transition": true, "reset": true, "glare": false, "maxGlare": 1 }';
342      if (typeof tiltOptions !== "undefined" && tiltOptions !== null) {
343        tiltOptions = $.parseJSON(tiltOptions);
344        _this.tilt(tiltOptions);
345      }
346    });
347  }
348
349  /****** Justified Gallery ******/
350  if ($(".justified-gallery").length > 0) {
351    $(".justified-gallery").each(function () {
352      var _this = $(this),
353        justifiedOptions =
354          _this.attr("data-justified-options") ||
355          '{ "rowHeight": 500, "maxRowHeight": false, "captions": true, "margins": 15, "waitThumbnailsLoad": true }';
356      if (
357        typeof justifiedOptions !== "undefined" &&
358        justifiedOptions !== null
359      ) {
360        _this.imagesLoaded(function () {
361          justifiedOptions = $.parseJSON(justifiedOptions);
362          _this.justifiedGallery(justifiedOptions);
363        });
364      }
365    });
366  }
367
368  /****** Justified Gallery Tooltip at cursor position ******/
369  if (!isMobile) {
370    $(document).on("mousemove", ".jg-entry", function (e) {
371      var imageWidth = $(this).width();
372      var captionWidth = $(this).find(".jg-caption").width();
373      var value = $(this).find(".caption").html();
374      var parentOffset = $(this).offset();
375      var relX = e.pageX - parentOffset.left + 20;
376      var relY = e.pageY - parentOffset.top;
377      if (relX + captionWidth + 30 > imageWidth) {
378        relX = relX - captionWidth - 65;
379      }
380      $(this).css("overflow", "visible");
381      $(this)
382        .find(".jg-caption")
383        .html(value)
384        .show()
385        .css({
386          left: relX + "px",
387          right: "auto",
388          top: relY + "px",
389          bottom: "auto",
390        });
391    });
392    $(document).on("mouseleave", ".jg-entry", function (e) {
393      $(this).css("overflow", " ");
394      $(this)
395        .find(".jg-caption")
396        .hide()
397        .css({ left: " ", right: " ", top: " ", bottom: " " });
398    });
399  }
400
401  /****** Accordion using active/inactive icon params ******/
402  $(".accordion-event").each(function () {
403    var _this = $(this),
404      activeIconClass = _this.attr("data-active-icon") || "",
405      inactiveIconClass = _this.attr("data-inactive-icon") || "";
406    $(".collapse", this)
407      .on("show.bs.collapse", function () {
408        var id = $(this).attr("id");
409        $('a[href="#' + id + '"]')
410          .closest(".panel-heading")
411          .addClass("active-accordion");
412        $('a[href="#' + id + '"] .panel-title i')
413          .addClass(activeIconClass)
414          .removeClass(inactiveIconClass);
415      })
416      .on("hide.bs.collapse", function () {
417        var id = $(this).attr("id");
418        $('a[href="#' + id + '"]')
419          .closest(".panel-heading")
420          .removeClass("active-accordion");
421        $('a[href="#' + id + '"] .panel-title i')
422          .addClass(inactiveIconClass)
423          .removeClass(activeIconClass);
424      });
425  });
426
427  /****** Accordion on checkout ******/
428  $(".checkout-accordion label input").on("click", function (e) {
429    var collapseId = $(this).parent().find("a").attr("href");
430    if ($(this).prop("checked")) {
431      $(collapseId).collapse("show");
432    } else {
433      $(collapseId).collapse("hide");
434    }
435  });
436
437  /****** Change on Bootstrap tab ******/
438  $('a[data-bs-toggle="tab"]').on("shown.bs.tab", function (e) {
439    // Hide Accordion on tab change event
440    $(".tab-content .accordion-event").each(function () {
441      $(".collapse", this).collapse("hide");
442    });
443    // Reset isotope on tab change event
444    resetIsotopeLayoutLoop(isotopeObjs, true);
445  });
446
447  /****** Countdown timer ******/
448  $(".countdown").each(function () {
449    var _this = $(this);
450    _this
451      .countdown(_this.attr("data-enddate"))
452      .on("update.countdown", function (event) {
453        _this.html(
454          event.strftime(
455            "" +
456              '<div class="countdown-container"><div class="countdown-box first"><div class="number">%-D</div><span>Day%!d</span></div>' +
457              '<div class="countdown-box"><div class="number">%H</div><span>Hours</span></div>' +
458              '<div class="countdown-box"><div class="number">%M</div><span>Minutes</span></div>' +
459              '<div class="countdown-box last"><div class="number">%S</div><span>Seconds</span></div></div>',
460          ),
461        );
462      });
463  });
464
465  /****** Wow animation ******/
466  if ($(".wow").length > 0) {
467    wow = new WOW({
468      boxClass: "wow",
469      animateClass: "animate__animated",
470      offset: 30,
471      mobile: mobileAnimation,
472      live: true,
473    });
474    $(document).imagesLoaded(function () {
475      wow.init();
476    });
477  }
478
479  /****** Portfolio isotope & filter ******/
480  $(".portfolio-wrapper").each(function () {
481    var _this = $(this);
482    if (!_this.find(".wow").length > 0) {
483      _this.find(".grid-item").css("visibility", "hidden");
484    }
485    _this.imagesLoaded(function () {
486      if (!_this.find(".wow").length > 0) {
487        _this.find(".grid-item").css("visibility", "");
488      } else if (!isMobile) {
489        _this.find(".grid-item").css("visibility", "hidden");
490      }
491      _this.removeClass("grid-loading");
492      _this.isotope({
493        layoutMode: "masonry",
494        itemSelector: ".grid-item",
495        percentPosition: true,
496        stagger: 0,
497        masonry: {
498          columnWidth: ".grid-sizer",
499        },
500      });
501      isotopeObjs.push(_this);
502    });
503  });
504  $(document).on("click", ".portfolio-filter > li > a", function () {
505    var _this = $(this),
506      parentSectionObj = _this.parents("section");
507    parentSectionObj.find(".portfolio-filter > li").removeClass("active");
508    _this.parent().addClass("active");
509    var selector = _this.attr("data-filter"),
510      portfolioFilter = parentSectionObj.find(".portfolio-wrapper");
511    // Remove animation
512    removeWowAnimation(portfolioFilter);
513    // Isotope filter
514    portfolioFilter.isotope({ filter: selector });
515    return false;
516  });
517
518  /****** Blog isotope & filter ******/
519  $(".blog-wrapper").each(function () {
520    var _this = $(this);
521    if (!_this.find(".wow").length > 0) {
522      _this.find(".grid-item").css("visibility", "hidden");
523    }
524    _this.imagesLoaded(function () {
525      if (!_this.find(".wow").length > 0) {
526        _this.find(".grid-item").css("visibility", "");
527      } else if (!isMobile) {
528        _this.find(".grid-item").css("visibility", "hidden");
529      }
530      _this.removeClass("grid-loading");
531      _this.isotope({
532        layoutMode: "masonry",
533        itemSelector: ".grid-item",
534        percentPosition: true,
535        stagger: 0,
536        masonry: {
537          columnWidth: ".grid-sizer",
538        },
539      });
540      isotopeObjs.push(_this);
541    });
542  });
543  $(document).on("click", ".blog-filter > li > a", function () {
544    var _this = $(this),
545      parentSectionObj = _this.parents("section");
546    parentSectionObj.find(".blog-filter > li").removeClass("active");
547    _this.parent().addClass("active");
548    var selector = _this.attr("data-filter"),
549      blogFilter = parentSectionObj.find(".blog-wrapper");
550    // Remove animation
551    removeWowAnimation(blogFilter);
552    // Isotope filter
553    blogFilter.isotope({ filter: selector });
554    return false;
555  });
556
557  /****** Shop isotope & filter ******/
558  $(".shop-wrapper").each(function () {
559    var _this = $(this);
560    if (!_this.find(".wow").length > 0) {
561      _this.find(".grid-item").css("visibility", "hidden");
562    }
563    _this.imagesLoaded(function () {
564      if (!_this.find(".wow").length > 0) {
565        _this.find(".grid-item").css("visibility", "");
566      } else if (!isMobile) {
567        _this.find(".grid-item").css("visibility", "hidden");
568      }
569      _this.removeClass("grid-loading");
570      _this.isotope({
571        layoutMode: "masonry",
572        itemSelector: ".grid-item",
573        percentPosition: true,
574        stagger: 0,
575        masonry: {
576          columnWidth: ".grid-sizer",
577        },
578      });
579      isotopeObjs.push(_this);
580    });
581  });
582  $(document).on("click", ".shop-filter > li > a", function () {
583    var _this = $(this),
584      parentSectionObj = _this.parents("section");
585    parentSectionObj.find(".shop-filter > li").removeClass("active");
586    _this.parent().addClass("active");
587    var selector = _this.attr("data-filter"),
588      shopFilter = parentSectionObj.find(".shop-wrapper");
589    // Remove animation
590    removeWowAnimation(shopFilter);
591    // Isotope filter
592    shopFilter.isotope({ filter: selector });
593    return false;
594  });
595
596  /****** Instagram feed ******/
597  var instagramWrapperItems = document.querySelectorAll(".instafeed-wrapper");
598  instagramWrapperItems.forEach(function (instagramWrapperItem, index) {
599    var token =
600        "IGQVJVSU5yVlZAUQUF4NGdOWVlhNHRhbm5HUUkyWmtTak5sVFZAsMU1Lcm80ZAzR3U3A1dUY5WlZAyLTlFSnlzdWRWNllkUTlkQUdxYTNTNUdxNUpCbUxSZADZAJN0VRakhaOFBPVWhiVnBzdUZAfWFJxVE5sSwZDZD",
601      _this = $(instagramWrapperItem),
602      token = _this.attr("data-token") || token,
603      total = _this.attr("data-total") || "6", // how much photos do you want to get
604      slider = _this.attr("data-slider-options"),
605      _html = _this.html(),
606      outputHTML = "";
607    if (typeof slider !== "undefined" && slider !== null) {
608      _this.html("");
609    }
610    $.ajax({
611      url:
612        "https://graph.instagram.com/me/media?fields=id,media_type,media_url,timestamp,permalink,comments_count,like_count&access_token=" +
613        token,
614      type: "GET",
615      success: function (response) {
616        outputHTML +=
617          _this.find(".grid-item").length > 0
618            ? '<li class="grid-sizer"></li>'
619            : "";
620        for (var x in response.data) {
621          if (x < parseInt(total)) {
622            if (response.data[x]["media_type"] == "IMAGE") {
623              var link = response.data[x]["permalink"] || "",
624                image = response.data[x]["media_url"] || "",
625                likes = response.data[x]["like_count"] || "",
626                comments = response.data[x]["comments_count"] || "",
627                output = _html;
628
629              output = output.replace(' href="#"', "");
630              output = output.replace(' src="#"', "");
631              output = output.replace("data-href", "href");
632              output = output.replace("data-src", "src");
633              output = output.replace("{{link}}", link);
634              output = output.replace("{{image}}", image);
635              output = output.replace("{{likes}}", likes);
636              output = output.replace("{{comments}}", comments);
637              outputHTML += output;
638            }
639          }
640        }
641        _this.html(outputHTML);
642        if (typeof slider !== "undefined" && slider !== null) {
643          // Apply swiper
644          var sliderOptions = $.parseJSON(slider);
645          var swiperObj = instagramWrapperItem.parentElement;
646          new Swiper(swiperObj, sliderOptions);
647        } else {
648          // Apply isotope
649          if (!_this.find(".wow").length > 0) {
650            _this.find(".grid-item").css("visibility", "hidden");
651          }
652          _this.imagesLoaded(function () {
653            if (!_this.find(".wow").length > 0) {
654              _this.find(".grid-item").css("visibility", "");
655            } else if (!isMobile) {
656              _this.find(".grid-item").css("visibility", "hidden");
657            }
658            _this.removeClass("grid-loading");
659            _this.isotope({
660              layoutMode: "masonry",
661              itemSelector: ".grid-item",
662              percentPosition: true,
663              stagger: 0,
664              masonry: {
665                columnWidth: ".grid-sizer",
666              },
667            });
668            isotopeObjs.push(_this);
669          });
670        }
671      },
672      error: function (data) {
673        var output =
674          '<div class="col-12"><span class=text-center>No Images Found</span></div>';
675        _this.append(output);
676      },
677    });
678  });
679
680  /****** Interactive portfolio ******/
681  if ($(".fullscreen-hover-list .hover-list-item").length > 0) {
682    var interactiveEventName = isMobile ? "click" : "mouseover";
683    $(document).on(
684      interactiveEventName,
685      ".fullscreen-hover-list .hover-list-item a",
686      function (e) {
687        if (!$(this).parent().hasClass("active")) {
688          $(".fullscreen-hover-list .hover-list-item").removeClass("active");
689          $(this).parent().addClass("active");
690          return false;
691        }
692      },
693    );
694  }
695
696  /****** Colorful portfolio ******/
697  if ($(".portfolio-colorful").length > 0) {
698    var gridItemCount = $(".portfolio-colorful").find(".grid-item").length,
699      colorList =
700        $(".portfolio-colorful").attr("data-backgroundcolor") || "#2e94eb",
701      colorOpacity = $(".portfolio-colorful").attr("data-opacity") || 1,
702      colorArray = colorList.split(","),
703      colorCount = colorArray.length;
704    for (var gridCount = 0; gridCount < gridItemCount; gridCount++) {
705      var color = colorArray[gridCount];
706      var rgbaCol =
707        "rgba(" +
708        parseInt(color.slice(-6, -4), 16) +
709        "," +
710        parseInt(color.slice(-4, -2), 16) +
711        "," +
712        parseInt(color.slice(-2), 16) +
713        "," +
714        colorOpacity +
715        ")";
716      $(".portfolio-colorful")
717        .find(".portfolio-hover:eq(" + gridCount + ")")
718        .css("background-color", rgbaCol);
719      if (colorCount < gridItemCount) {
720        colorArray.push(colorArray[gridCount]);
721      }
722    }
723  }
724
725  /****** Colorful page title ******/
726  if ($(".page-title-colorful").length > 0) {
727    var colorList =
728        $(".page-title-colorful").attr("data-backgroundcolor") || "#2e94eb",
729      colorArray = colorList.split(","),
730      colorArray = colorList.split(","),
731      colorCount = colorArray.length,
732      i = 1,
733      colorCode;
734    $(".page-title-colorful").css({ "background-color": colorArray[0] });
735    setInterval(function () {
736      colorCode = colorArray[i];
737      $(".page-title-colorful").css({ "background-color": colorCode });
738      i++;
739      if (i === colorCount) {
740        i = 0;
741      }
742    }, 5000);
743  }
744
745  /******* Search popup open *******/
746  // NOTE: This handler is kept as a fallback. The primary handler is now in
747  // custom.js using Drupal.behaviors (searchIconHandler) which is more
748  // reliable with cached JavaScript and AJAX updates.
749  $(document).on("click", ".search-form-icon", function (e) {
750    e.stopPropagation();
751    e.preventDefault();
752    if ($(this).parents(".top-bar").length > 0) {
753      $("body").addClass("show-search-popup-mini-header");
754    }
755
756    $(".search-form-wrapper").addClass("active-form");
757    $("body").addClass("show-search-popup");
758  });
759
760  /******* Search popup close *******/
761  // NOTE: This handler is kept as a fallback. The primary handler is now in
762  // custom.js using Drupal.behaviors (searchIconHandler) which is more
763  // reliable with cached JavaScript and AJAX updates.
764  $(document).on("click", ".search-close", function (e) {
765    e.preventDefault();
766    $(".search-form-wrapper").removeClass("active-form");
767    if ($(this).parents(".top-bar").length > 0) {
768      $("body").removeClass("show-search-popup-mini-header");
769    }
770    $("body").removeClass("show-search-popup");
771  });
772
773  /****** Search validation ******/
774  $(document).on("click", ".search-button", function () {
775    var error = true;
776    var formObj = $(this).parents("form");
777    formObj.find("input[type=text]").each(function (index) {
778      var _this = $(this),
779        searchVal = _this.val();
780      if (searchVal === null || searchVal === "") {
781        formObj.find("input:eq(" + index + ")").addClass("search-error");
782        error = false;
783      } else {
784        formObj.find("input:eq(" + index + ")").removeClass("search-error");
785      }
786    });
787    return error;
788  });
789
790  /******* Hamburger menu open *******/
791  $(document).on("click", ".header-push-button .push-button", function () {
792    $("body").toggleClass("show-menu");
793    $("body").toggleClass("hamburger-show-menu");
794  });
795
796  /******* Hamburger / Side menu close *******/
797  $(document).on("click", ".close-menu", function () {
798    if (!flag) {
799      flag = true;
800      setTimeout(function () {
801        flag = false;
802      }, 500);
803      $("body")
804        .removeClass("show-menu")
805        .removeClass("left-classic-mobile-menu");
806      $(".sub-menu-item").collapse("hide");
807      $(".menu-list-item.open").removeClass("show");
808    }
809  });
810
811  /******* Side menu close on outside area *******/
812  $(document).on("touchstart click", ".show-menu", function (e) {
813    if (
814      !(
815        $(e.target).hasClass("push-button") ||
816        $(e.target).closest(".push-button").length ||
817        $(e.target).closest(".push-menu").length ||
818        $(e.target).closest(".hamburger-menu").length
819      )
820    ) {
821      $(".close-menu").trigger("click");
822    }
823  });
824
825  /******* Side menu open *******/
826  $(document).on("click", ".side-menu-button", function () {
827    $("body").toggleClass("show-menu");
828    // For Left Classic menu in Mobile
829    if (
830      $(".left-sidebar-wrapper").length > 0 &&
831      getWindowWidth() <= menuBreakPoint
832    ) {
833      $("body").toggleClass("left-classic-mobile-menu");
834    }
835    $(".sub-menu-item").collapse("hide");
836    $(".menu-list-item.open").removeClass("show");
837  });
838
839  /******* Close on escape key *******/
840  $(document).on("keydown", function (e) {
841    if (e.keyCode === 27) {
842      // Close side menu
843      $(".close-menu").trigger("click");
844
845      $(window).trigger("closemenu");
846    }
847  });
848
849  /****** Scroll to top *****/
850  $(document).on("click", ".scroll-top-arrow", function () {
851    $("html, body").animate({ scrollTop: 0 }, 800);
852    return false;
853  });
854
855  /****** Smooth scroll ******/
856  var scrollAnimationTime = 1200,
857    scrollAnimation = "easeInOutExpo";
858  $("a.scrollto").bind("click.smoothscroll", function (event) {
859    event.preventDefault();
860    var target = this.hash;
861    if ($(target).length !== 0) {
862      $("html, body")
863        .stop()
864        .animate(
865          {
866            scrollTop: $(target).offset().top,
867          },
868          scrollAnimationTime,
869          scrollAnimation,
870          function () {
871            window.location.hash = target;
872          },
873        );
874    }
875  });
876
877  /****** Inner link ******/
878  if ($(".navbar-reverse-scroll").length > 0) {
879    $(".inner-link").smoothScroll({
880      speed: 900,
881      offset: 0,
882      beforeScroll: function () {
883        $(".navbar-collapse.collapse").collapse("hide");
884      },
885    });
886  } else {
887    $(".inner-link").smoothScroll({
888      speed: 900,
889      offset: -59,
890      beforeScroll: function () {
891        $(".navbar-collapse.collapse").collapse("hide");
892      },
893    });
894  }
895
896  /****** Section link ******/
897  $(".section-link").smoothScroll({
898    speed: 900,
899    offset: 1,
900    beforeScroll: function () {
901      $(".navbar-collapse.collapse").collapse("hide");
902    },
903  });
904
905  /****** Subscribe popup on page load ******/
906  if ($("#subscribe-popup").length > 0) {
907    var delaySecond = 1,
908      expireDays = 30,
909      cookieName = "litho-promo-popup";
910    if (getCookie(cookieName) != "shown") {
911      setTimeout(function () {
912        $.magnificPopup.open({
913          showCloseBtn: false,
914          items: {
915            src: "#subscribe-popup",
916          },
917          type: "inline",
918          mainClass: "my-mfp-zoom-in",
919          callbacks: {
920            close: function () {
921              if ($("#newsletter-off").is(":checked")) {
922                setCookie(cookieName, "shown", expireDays);
923              }
924            },
925          },
926        });
927      }, delaySecond * 1000);
928    }
929  }
930
931  /****** Coming soon notify me form popup ******/
932  $(".notify-form-button").magnificPopup({
933    mainClass: "mfp-notify",
934    closeOnBgClick: true,
935    preloader: false,
936    fixedContentPos: false,
937    removalDelay: 100,
938    closeBtnInside: false,
939    callbacks: {
940      open: function () {
941        setTimeout(function () {
942          $(".notify-input").focus();
943        }, 100);
944        $("#notify_form").parent().addClass("notify-popup");
945        $("#notify_form").parents("body").addClass("show-notify-popup");
946      },
947      close: function () {
948        $("body").removeClass("show-notify-popup");
949      },
950    },
951  });
952
953  /****** Lightbox gallery ******/
954  $(".lightbox-gallery").magnificPopup({
955    delegate: "a",
956    type: "image",
957    tLoading: "Loading image #%curr%...",
958    mainClass: "mfp-fade",
959    fixedContentPos: true,
960    closeBtnInside: false,
961    gallery: {
962      enabled: true,
963      navigateByImgClick: true,
964      preload: [0, 1], // Will preload 0 - before current, and 1 after the current image
965    },
966  });
967
968  /* Group light box gallery image */
969  var lightboxgallerygroups = {};
970  $(".lightbox-group-gallery-item").each(function () {
971    var id = $(this).attr("data-group");
972    if (!lightboxgallerygroups[id]) {
973      lightboxgallerygroups[id] = [];
974    }
975    lightboxgallerygroups[id].push(this);
976  });
977  $.each(lightboxgallerygroups, function () {
978    $(this).magnificPopup({
979      type: "image",
980      closeOnContentClick: true,
981      closeBtnInside: false,
982      fixedContentPos: true,
983      gallery: { enabled: true },
984    });
985  });
986
987  /****** Lightbox portfolio gallery ******/
988  $(".lightbox-portfolio").magnificPopup({
989    delegate: ".gallery-link",
990    type: "image",
991    tLoading: "Loading image #%curr%...",
992    mainClass: "mfp-fade",
993    fixedContentPos: true,
994    closeBtnInside: false,
995    closeOnContentClick: true,
996    gallery: {
997      enabled: true,
998      navigateByImgClick: false,
999      preload: [0, 1], // Will preload 0 - before current, and 1 after the current image
1000    },
1001  });
1002
1003  /****** Single image lightbox - zoom animation ******/
1004  $(".single-image-lightbox").magnificPopup({
1005    type: "image",
1006    closeOnContentClick: true,
1007    fixedContentPos: true,
1008    closeBtnInside: false,
1009    mainClass: "mfp-no-margins mfp-with-zoom", // class to remove default margin from left and right side
1010    image: {
1011      verticalFit: true,
1012    },
1013    zoom: {
1014      enabled: true,
1015      duration: 300, // don't foget to change the duration also in CSS
1016    },
1017  });
1018
1019  /****** Zoom gallery ******/
1020  $(".zoom-gallery").magnificPopup({
1021    delegate: "a",
1022    type: "image",
1023    mainClass: "mfp-with-zoom mfp-img-mobile",
1024    fixedContentPos: true,
1025    closeBtnInside: false,
1026    image: {
1027      verticalFit: true,
1028      titleSrc: function (item) {
1029        return item.el.attr("title");
1030      },
1031    },
1032    gallery: {
1033      enabled: true,
1034    },
1035    zoom: {
1036      enabled: true,
1037      duration: 300, // don't foget to change the duration also in CSS
1038      opener: function (element) {
1039        return element.find("img");
1040      },
1041    },
1042  });
1043
1044  /****** Modal popup ******/
1045  $(".modal-popup").magnificPopup({
1046    type: "inline",
1047    preloader: false,
1048    // modal: true,
1049    blackbg: true,
1050  });
1051
1052  /****** Modal popup close ******/
1053  $(document).on("click", ".popup-modal-dismiss", function (e) {
1054    e.preventDefault();
1055    $.magnificPopup.close();
1056  });
1057
1058  /****** Modal popup - zoom animation ******/
1059  $(".popup-with-zoom-anim").magnificPopup({
1060    type: "inline",
1061    fixedContentPos: false,
1062    fixedBgPos: true,
1063    overflowY: "auto",
1064    closeBtnInside: true,
1065    preloader: false,
1066    midClick: true,
1067    removalDelay: 300,
1068    blackbg: true,
1069    mainClass: "my-mfp-zoom-in",
1070  });
1071
1072  /****** Modal popup - move animation ******/
1073  $(".popup-with-move-anim").magnificPopup({
1074    type: "inline",
1075    fixedContentPos: false,
1076    fixedBgPos: true,
1077    overflowY: "auto",
1078    closeBtnInside: true,
1079    preloader: false,
1080    midClick: true,
1081    removalDelay: 300,
1082    blackbg: true,
1083    mainClass: "my-mfp-slide-bottom",
1084  });
1085
1086  /****** Popup with form ******/
1087  $(".popup-with-form").magnificPopup({
1088    type: "inline",
1089    preloader: false,
1090    closeBtnInside: false,
1091    fixedContentPos: true,
1092    focus: "#name",
1093    callbacks: {
1094      beforeOpen: function () {
1095        if (getWindowWidth() < 700) {
1096          this.st.focus = false;
1097        } else {
1098          this.st.focus = "#name";
1099        }
1100      },
1101    },
1102  });
1103
1104  /****** Video magnific popup ******/
1105  $(".popup-youtube, .popup-vimeo").magnificPopup({
1106    disableOn: 767,
1107    type: "iframe",
1108    mainClass: "mfp-fade",
1109    removalDelay: 160,
1110    preloader: false,
1111    fixedContentPos: true,
1112    closeBtnInside: false,
1113  });
1114
1115  /****** Google map magnific popup ******/
1116  $(".popup-googlemap").magnificPopup({
1117    disableOn: 0,
1118    type: "iframe",
1119    mainClass: "mfp-fade",
1120    removalDelay: 160,
1121    preloader: false,
1122    fixedContentPos: true,
1123    closeBtnInside: false,
1124  });
1125
1126  /****** Ajax magnific popup ******/
1127  $(".ajax-popup").magnificPopup({
1128    type: "ajax",
1129    alignTop: true,
1130    fixedContentPos: true,
1131    closeBtnInside: false,
1132    overflowY: "scroll", // as we know that popup content is tall we set scroll overflow by default to avoid jump
1133    callbacks: {
1134      open: function () {
1135        $(".navbar .collapse").removeClass("show");
1136        $(".navbar a.dropdown-toggle").addClass("collapsed");
1137      },
1138    },
1139  });
1140
1141  /****** Contact form validation on submit ******/
1142  $(document).on("click", ".submit", function () {
1143    var error = false,
1144      captchaFlag = false,
1145      _this = $(this),
1146      formObj = _this.parents("form"),
1147      emailFormat = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,
1148      telFormat = /[0-9 -()+]+$/,
1149      actionURL = formObj.attr("action"),
1150      resultsObj = formObj.find(".form-results"),
1151      grecaptchav3 = _this.attr("data-sitekey") || "",
1152      redirectVal = formObj.find('[name="redirect"]').val();
1153    formObj.find(".required").removeClass("error");
1154    formObj.find(".required").each(function () {
1155      var __this = $(this),
1156        fieldVal = __this.val();
1157      if (fieldVal == "" || fieldVal == undefined) {
1158        error = true;
1159        __this.addClass("error");
1160      } else if (
1161        __this.attr("type") == "email" &&
1162        !emailFormat.test(fieldVal)
1163      ) {
1164        error = true;
1165        __this.addClass("error");
1166      } else if (__this.attr("type") == "tel" && !telFormat.test(fieldVal)) {
1167        error = true;
1168        __this.addClass("error");
1169      }
1170    });
1171    var termsObj = formObj.find(".terms-condition");
1172    if (termsObj.length > 0) {
1173      if (!termsObj.is(":checked")) {
1174        error = true;
1175        termsObj.addClass("error");
1176      }
1177    }
1178    // Google reCaptcha Verify
1179    if (typeof grecaptcha !== "undefined" && grecaptcha !== null) {
1180      if (formObj.find(".g-recaptcha").length > 0) {
1181        // For Version 2
1182        var gResponse = grecaptcha.getResponse();
1183        if (!gResponse.length) {
1184          error = true;
1185          formObj.find(".g-recaptcha").addClass("error");
1186        }
1187      } else if (grecaptchav3 != "" && grecaptchav3 != undefined) {
1188        // For Version 3
1189        captchaFlag = true;
1190        formObj
1191          .find("input[name=action],input[name=g-recaptcha-response]")
1192          .remove();
1193        grecaptcha.ready(function () {
1194          grecaptcha
1195            .execute(grecaptchav3, { action: "subscribe_newsletter" })
1196            .then(function (token) {
1197              formObj.prepend(
1198                '<input type="hidden" name="g-recaptcha-response" value="' +
1199                  token +
1200                  '">',
1201              );
1202              formObj.prepend(
1203                '<input type="hidden" name="action" value="subscribe_newsletter">',
1204              );
1205
1206              if (!error) {
1207                submitAJAXForm(_this);
1208              }
1209            });
1210        });
1211      }
1212    }
1213    if (!error && !captchaFlag) {
1214      // Check no errors && no google reCaptcha V3
1215      submitAJAXForm(_this);
1216    }
1217    return false;
1218  });
1219
1220  /****** Contact form validation on blur ******/
1221  $(document).on("blur", ".required", function () {
1222    var emailFormat = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,
1223      telFormat = /[0-9 -()+]+$/,
1224      fieldVal = $(this).val();
1225    if (fieldVal == "" || fieldVal == undefined) {
1226      $(this).addClass("error");
1227    } else if ($(this).attr("type") == "email" && !emailFormat.test(fieldVal)) {
1228      $(this).addClass("error");
1229    } else if ($(this).attr("type") == "tel" && !telFormat.test(fieldVal)) {
1230      $(this).addClass("error");
1231    } else {
1232      $(this).removeClass("error");
1233    }
1234  });
1235
1236  /****** Validate terms and conditions in form ******/
1237  $(document).on("click", ".terms-condition", function () {
1238    var termsObj = $(this);
1239    if (!termsObj.is(":checked")) {
1240      termsObj.addClass("error");
1241    } else {
1242      termsObj.removeClass("error");
1243    }
1244  });
1245
1246  /****** Active class to current menu for only html ******/
1247  var pgurl = window.location.href.substr(
1248    window.location.href.lastIndexOf("/") + 1,
1249  );
1250  var $hash = window.location.hash.substring(1);
1251  if ($hash) {
1252    $hash = "#" + $hash;
1253    pgurl = pgurl.replace($hash, "");
1254  } else {
1255    pgurl = pgurl.replace("#", "");
1256  }
1257  $(".navbar-nav li a, .menu-list a").each(function () {
1258    var _this = $(this),
1259      aHref = _this.attr("href");
1260    if (aHref === pgurl || aHref === pgurl + ".html") {
1261      _this.addClass("active");
1262      _this.parent().addClass("active");
1263      _this.parents("li.dropdown").addClass("active");
1264      _this.parents("li.menu-list-item").addClass("active");
1265    }
1266  });
1267
1268  /****** Mobile menu modern style ******/
1269  var mobileStyle = $("body").attr("data-mobile-nav-style");
1270  if (
1271    (mobileStyle == "modern" || mobileStyle == "full-screen-menu") &&
1272    !$(".navbar-" + mobileStyle + "-inner").length
1273  ) {
1274    if (!$(".box-layout").length > 0 && mobileStyle == "modern") {
1275      $("section, footer").wrapAll('<div class="page-layout"></div>');
1276    } else {
1277      $("section").wrapAll('<div class="page-layout"></div>');
1278    }
1279    var targetButtonClone = $(".navbar .navbar-toggler")
1280      .clone(true)
1281      .addClass("navbar-toggler-clone")
1282      .insertAfter(".page-layout");
1283    var targetNavClone = $(".navbar .navbar-collapse")
1284      .clone(true)
1285      .addClass("navbar-collapse-clone")
1286      .attr("id", "navbarNav-clone")
1287      .insertAfter(".page-layout");
1288    $(".navbar-toggler-clone, .navbar-collapse-clone").wrapAll(
1289      '<div class="navbar-' + mobileStyle + '-inner"></div>',
1290    );
1291    $(".navbar-toggler")
1292      .attr("data-bs-target", "#navbarNav-clone")
1293      .attr("aria-controls", "#navbarNav-clone");
1294    $(".navbar-" + mobileStyle + "-inner")
1295      .find(".dropdown-toggle")
1296      .addClass("dropdown-toggle-clone");
1297    if ($(".navbar-collapse-clone").length > 0) {
1298      var scrollOptions =
1299        $(".navbar-collapse-clone").attr("data-scroll-options") ||
1300        '{ "theme": "light" }';
1301      if (typeof scrollOptions !== "undefined" && scrollOptions !== null) {
1302        scrollOptions = $.parseJSON(scrollOptions);
1303        $(".navbar-collapse-clone").mCustomScrollbar(scrollOptions);
1304      }
1305    }
1306    if (mobileStyle == "modern") {
1307      $('<div class="navbar-show-modern-bg"></div>').insertAfter(
1308        ".page-layout",
1309      );
1310    }
1311  }
1312
1313  /****** Hide collaps on outside click ******/
1314  $(document).on("touchstart click", "body", function (e) {
1315    if (!$(e.target).closest(".navbar-nav").length) {
1316      if (!$(e.target).closest(".header-language").length) {
1317        // Close language menu
1318        $(".header-language").trigger("mouseleave");
1319        $(".header-language").removeClass("show");
1320        $(".header-language").children(".dropdown-menu").removeClass("show");
1321      }
1322      if (!$(e.target).closest(".header-cart-icon").length) {
1323        // Close cart
1324        $(".header-cart-icon").trigger("mouseleave");
1325        $(".header-cart-icon").removeClass("show");
1326        $(".header-cart-icon").children(".dropdown-menu").removeClass("show");
1327      }
1328      // Close all dropdown
1329      $(".navbar-nav .dropdown").each(function () {
1330        var _this = $(this);
1331        _this.trigger("mouseleave");
1332        _this.removeClass("show");
1333        _this.children(".dropdown-menu").removeClass("show");
1334      });
1335      // Close classic menu
1336      $('[data-mobile-nav-style="classic"] .navbar-collapse').collapse("hide");
1337      // Close theme demos
1338      if (
1339        !$(e.target).closest(".theme-demos").length &&
1340        $(".theme-demos").hasClass("active")
1341      ) {
1342        $(".theme-demos").removeClass("active");
1343        $("body").removeClass("overflow-hidden");
1344      }
1345    } else if ($(e.target).parents(".show-menu").length) {
1346      // Close side menu
1347      $(".close-menu").trigger("click");
1348    } else if (
1349      $(e.target).parents("body").find(".header-language.open").length
1350    ) {
1351      // Close language menu
1352      $(".header-language").trigger("mouseleave");
1353      $(".header-language").removeClass("show");
1354      $(".header-language").children(".dropdown-menu").removeClass("show");
1355    } else if (
1356      $(e.target).parents("body").find(".header-cart-icon.open").length
1357    ) {
1358      // Close cart
1359      $(".header-cart-icon").trigger("mouseleave");
1360      $(".header-cart-icon").removeClass("show");
1361      $(".header-cart-icon").children(".dropdown-menu").removeClass("show");
1362    }
1363    if (!$(e.target).parents("header") && isMobile) {
1364      $(".header-language, .header-cart-icon").each(function () {
1365        var _this = $(this);
1366        _this.trigger("mouseleave");
1367        _this.removeClass("show");
1368        _this.children(".dropdown-menu").removeClass("show");
1369      });
1370    }
1371    if (
1372      $(e.target).closest(".search-form-wrapper").length === 0 ||
1373      $(e.target).is(".form-wrapper")
1374    ) {
1375      $(".search-form-wrapper").removeClass("active-form");
1376      $("body").removeClass("show-search-popup");
1377    }
1378  });
1379
1380  /****** Navbar collapse classic menu event ******/
1381  $('[data-mobile-nav-style="classic"] .navbar-collapse.collapse')
1382    .on("show.bs.collapse", function () {
1383      if (!$("body").hasClass("navbar-collapse-show")) {
1384        $("body").addClass("navbar-collapse-show");
1385      }
1386    })
1387    .on("hide.bs.collapse", function () {
1388      if ($("body").hasClass("navbar-collapse-show")) {
1389        $("body").removeClass("navbar-collapse-show");
1390      }
1391    });
1392
1393  /****** Navbar collapse modern & full screen event ******/
1394  $(".navbar-collapse-clone")
1395    .on("show.bs.collapse", function () {
1396      if (!$("body").hasClass("navbar-collapse-show")) {
1397        $("body").addClass("navbar-collapse-show");
1398        $("html").addClass("overflow-hidden");
1399        if (
1400          $("body").attr("data-mobile-nav-bg-color") &&
1401          $(".navbar-modern-inner").length > 0
1402        ) {
1403          var bgColor = $("body").attr("data-mobile-nav-bg-color");
1404          $(".navbar-show-modern-bg").css("background", bgColor);
1405        }
1406        if (
1407          $("body").attr("data-mobile-nav-bg-color") &&
1408          $(".navbar-full-screen-menu-inner").length > 0
1409        ) {
1410          var bgColor = $("body").attr("data-mobile-nav-bg-color");
1411          $(".navbar-full-screen-menu-inner").css("background", bgColor);
1412        }
1413      } else {
1414        if ($(".navbar-modern-inner").length > 0) {
1415          setTimeout(function () {
1416            $(".navbar-show-modern-bg").css("background", "");
1417          }, 600);
1418        }
1419        if ($(".navbar-full-screen-menu-inner").length > 0) {
1420          setTimeout(function () {
1421            $(".navbar-full-screen-menu-inner").css("background", "");
1422          }, 600);
1423        }
1424      }
1425      var headerHeight = getTopSpaceHeaderHeight();
1426      var windowHeight = getWindowHeight();
1427      if (
1428        $(".navbar-modern-inner").length > 0 ||
1429        $(".navbar-full-screen-menu-inner").length > 0
1430      ) {
1431        $(this).css("max-height", windowHeight);
1432      } else {
1433        $(this).css("max-height", windowHeight - headerHeight);
1434      }
1435    })
1436    .on("hide.bs.collapse", function () {
1437      if ($("body").hasClass("navbar-collapse-show")) {
1438        $("body").removeClass("navbar-collapse-show");
1439        $("html").removeClass("overflow-hidden");
1440      }
1441    });
1442
1443  /****** Hamburger menu animation with collapse ******/
1444  $(".menu-toggle").each(function (index) {
1445    var _this = $(this);
1446    _this
1447      .addClass("collapsed")
1448      .attr({
1449        "data-bs-toggle": "collapse",
1450        "data-bs-target": "#sub-menu-" + index,
1451      });
1452    _this
1453      .parent()
1454      .find(".sub-menu-item")
1455      .attr("id", "sub-menu-" + index)
1456      .addClass("collapse");
1457  });
1458
1459  /****** Sticky left menu ******/
1460  if ($(".left-sidebar-wrapper").length > 0) {
1461    $(".left-sidebar-wrapper .left-sidebar-nav").stick_in_parent({
1462      recalc: 1,
1463      bottoming: false,
1464    });
1465  }
1466  $(document).on(
1467    "click",
1468    ".menu-list > .menu-list-item > .menu-toggle",
1469    function () {
1470      $(".sub-menu-item").each(function () {
1471        $(this).collapse("hide");
1472      });
1473      $(".left-sidebar-wrapper .left-sidebar-nav")
1474        .parents("body")
1475        .addClass("left-classic-mobile-menu");
1476      setTimeout(function () {
1477        $(".left-sidebar-wrapper").trigger("sticky_kit:recalc");
1478      }, 500);
1479    },
1480  );
1481  $(document).on(
1482    "click",
1483    ".sub-menu-item > .menu-list-item > .menu-toggle",
1484    function (e) {
1485      e.preventDefault();
1486      var _parent = $(this).parent().find(".sub-menu-item");
1487      var _parentAttr = $(this).attr("data-bs-target");
1488      $(this)
1489        .parent()
1490        .parent(".sub-menu-item")
1491        .find(".sub-menu-item")
1492        .each(function () {
1493          var _this = $(this),
1494            attr = _this.parent().find(".menu-toggle").attr("data-bs-target");
1495          if (attr != _parentAttr) {
1496            _this.collapse("hide");
1497          }
1498        });
1499      $(".left-sidebar-wrapper .left-sidebar-nav")
1500        .parents("body")
1501        .addClass("left-classic-mobile-menu");
1502      setTimeout(function () {
1503        $(".left-sidebar-wrapper").trigger("sticky_kit:recalc");
1504      }, 500);
1505    },
1506  );
1507
1508  /******* Sidebar nav open *******/
1509  $(document).on("click", "#mobileToggleSidenav", function (e) {
1510    e.preventDefault();
1511    $(this).closest("nav").toggleClass("sidemenu-open");
1512  });
1513
1514  /******* Navbar toggle *******/
1515  var flag = false;
1516  $(document).on("click", ".navbar-toggle", function () {
1517    if (getWindowWidth() > menuBreakPoint) {
1518      if (!flag) {
1519        flag = true;
1520        setTimeout(function () {
1521          flag = false;
1522        }, 500);
1523        $("body").addClass("show-menu");
1524      } else {
1525        if (
1526          !$(".navbar-collapse").has(e.target).is(".navbar-collapse") &&
1527          $(".navbar-collapse ul").hasClass("show")
1528        ) {
1529          $(".navbar-collapse").find("a.dropdown-toggle").addClass("collapsed");
1530          $(".navbar-collapse").find("ul.dropdown-menu").removeClass("show");
1531          $(".navbar-collapse a.dropdown-toggle").removeClass("active");
1532        }
1533      }
1534    }
1535  });
1536
1537  /****** Open menu on hover ******/
1538  $(".dropdown")
1539    .on("mouseenter touchstart", function (e) {
1540      var _this = $(this);
1541      _this.siblings(".dropdown").removeClass("open");
1542      _this
1543        .parents(".navbar-nav")
1544        .siblings(".navbar-nav")
1545        .find(".dropdown")
1546        .removeClass("open");
1547      _this.addClass("open");
1548      if (getWindowWidth() > menuBreakPoint) {
1549        menuPosition(_this);
1550        if ($(e.target).siblings(".dropdown-menu").length) {
1551          e.preventDefault();
1552        }
1553      }
1554    })
1555    .on("mouseleave", function (e) {
1556      var _this = $(this);
1557      _this.removeClass("menu-left");
1558      _this.removeClass("open");
1559    });
1560
1561  /****** GDPR policy ******/
1562  var gdprExpireDays = 30;
1563  var gdprCookieName = "litho-gdpr-policy";
1564  // var gdprHTML = '<div class="gdpr-wrapper"><div class="gdpr-container bg-extra-dark-gray text-center"><div class="gdpr-content alt-font text-medium text-white"> Our site uses cookies. By continuing to our site you are agreeing to our cookie <a href="privacy.html" target="_blank" class="text-decoration-line-bottom text-white">privacy policy</a></div> <a href="javascript:void(0);" class="btn btn-fancy btn-very-small btn-white gdpr-policy-button">Got it</a></div></div>';
1565  // if( getCookie( gdprCookieName ) != 'shown' ) {
1566  //     $( 'body' ).append( gdprHTML );
1567  // }
1568  $(document).on("click", ".gdpr-policy-button", function () {
1569    $(".gdpr-wrapper").fadeOut().remove();
1570    setCookie(gdprCookieName, "shown", gdprExpireDays);
1571  });
1572
1573  /****** Theme demo panel ******/
1574  // var themeDemoHTML = '<div class="theme-demos"><div class="all-demo"><a href="javascript:void(0);"><i class="feather icon-feather-x align-middle"></i><div class="theme-wrapper"><div><i class="feather icon-feather-layers align-middle"></i><span>37+</span> demos</div></div></a></div><div class="buy-theme sm-display-none"><a href="https://1.envato.market/AL7Oj" target="_blank"><i class="feather icon-feather-shopping-bag align-middle"></i><div class="theme-wrapper"><div><i class="feather icon-feather-shopping-bag align-middle"></i>Buy now</div></div></a></div> <section class="d-flex align-items-center justify-content-center"><div class="demos-wrapper d-flex align-items-center w-100" data-scroll-options=\'{ "theme": "dark" }\'><div class="w-100"><div class="col-12 text-center margin-1-rem-bottom"> <span class="alt-font font-weight-600 text-extra-medium text-gradient-sky-blue-dark-pink text-uppercase letter-spacing-minus-1-half d-inline-block margin-5px-bottom">Truly multipurpose</span><h5 class="alt-font font-weight-600 text-extra-dark-gray d-inline-block letter-spacing-minus-1px padding-twenty-lr margin-25px-bottom">37+ Unique demos</h5></div><ul class="portfolio-switch-image portfolio-wrapper grid grid-3col gutter-extra-large text-center"><li class="grid-sizer"></li><li class="grid-item"><div class="portfolio-box"><div class="portfolio-image border-radius-4px box-shadow-double-large"> <a href="home-startup.html" target="_blank"> <img src="images/litho-demo-startup.jpg" alt="" /> </a></div><div class="portfolio-caption padding-15px-top"> <a href="home-startup.html" target="_blank" class="alt-font text-small text-extra-dark-gray text-extra-dark-gray-hover font-weight-500 d-inline-block">Startup</a></div></div></li><li class="grid-item"><div class="portfolio-box"><div class="portfolio-image border-radius-4px box-shadow-double-large"> <a href="home-yoga-meditation.html" target="_blank"> <img src="images/litho-demo-yoga-meditation.jpg" alt="" /> </a></div><div class="portfolio-caption padding-15px-top"> <a href="home-yoga-meditation.html" target="_blank" class="alt-font text-small text-extra-dark-gray text-extra-dark-gray-hover font-weight-500 d-inline-block">Yoga Meditation</a></div></div></li><li class="grid-item"><div class="portfolio-box"><div class="portfolio-image border-radius-4px box-shadow-double-large"> <a href="home-restaurant.html" target="_blank"> <img src="images/litho-demo-restaurant.jpg" alt="" /> </a></div><div class="portfolio-caption padding-15px-top"> <a href="home-restaurant.html" target="_blank" class="alt-font text-small text-extra-dark-gray text-extra-dark-gray-hover font-weight-500 d-inline-block">Restaurant</a></div></div></li><li class="grid-item"><div class="portfolio-box"><div class="portfolio-image border-radius-4px box-shadow-double-large"> <a href="home-corporate.html" target="_blank"> <img src="images/litho-demo-corporate.jpg" alt="" /> </a></div><div class="portfolio-caption padding-15px-top"> <a href="home-corporate.html" target="_blank" class="alt-font text-small text-extra-dark-gray text-extra-dark-gray-hover font-weight-500 d-inline-block">Corporate</a></div></div></li><li class="grid-item"><div class="portfolio-box"><div class="portfolio-image border-radius-4px box-shadow-double-large"> <a href="home-architecture.html" target="_blank"> <img src="images/litho-demo-architecture.jpg" alt="" /> </a></div><div class="portfolio-caption padding-15px-top"> <a href="home-architecture.html" target="_blank" class="alt-font text-small text-extra-dark-gray text-extra-dark-gray-hover font-weight-500 d-inline-block">Architecture</a></div></div></li><li class="grid-item"><div class="portfolio-box"><div class="portfolio-image border-radius-4px box-shadow-double-large"> <a href="home-design-agency.html" target="_blank"> <img src="images/litho-demo-design-agency.jpg" alt="" /> </a></div><div class="portfolio-caption padding-15px-top"> <a href="home-design-agency.html" target="_blank" class="alt-font text-small text-extra-dark-gray text-extra-dark-gray-hover font-weight-500 d-inline-block">Design Agency</a></div></div></li><li class="grid-item"><div class="portfolio-box"><div class="portfolio-image border-radius-4px box-shadow-double-large"> <a href="home-marketing-agency.html" target="_blank"> <img src="images/litho-demo-marketing-agency.jpg" alt="" /> </a></div><div class="portfolio-caption padding-15px-top"> <a href="home-marketing-agency.html" target="_blank" class="alt-font text-small text-extra-dark-gray text-extra-dark-gray-hover font-weight-500 d-inline-block">Marketing Agency</a></div></div></li><li class="grid-item"><div class="portfolio-box"><div class="portfolio-image border-radius-4px box-shadow-double-large"> <a href="home-freelancer.html" target="_blank"> <img src="images/litho-demo-freelancer.jpg" alt="" /> </a></div><div class="portfolio-caption padding-15px-top"> <a href="home-freelancer.html" target="_blank" class="alt-font text-small text-extra-dark-gray text-extra-dark-gray-hover font-weight-500 d-inline-block">Freelancer</a></div></div></li><li class="grid-item"><div class="portfolio-box"><div class="portfolio-image border-radius-4px box-shadow-double-large"> <a href="home-travel-agency.html" target="_blank"> <img src="images/litho-demo-travel-agency.jpg" alt="" /> </a></div><div class="portfolio-caption padding-15px-top"> <a href="home-travel-agency.html" target="_blank" class="alt-font text-small text-extra-dark-gray text-extra-dark-gray-hover font-weight-500 d-inline-block">Travel Agency</a></div></div></li></ul><div class="col-12 text-center clearfix"> <a href="index.html" class="btn btn-large btn-dark-gray d-table d-lg-inline-block margin-40px-top btn-fancy" target="_blank">View all 37+ demos</a></div></div></div> </section></div>';
1575  // $( 'body:not( .landing )' ).append( themeDemoHTML );
1576  $(document).on("click", ".all-demo", function () {
1577    var themeDemosObj = $(this).parents(".theme-demos");
1578    if (!themeDemosObj.hasClass("active")) {
1579      themeDemosObj.addClass("active");
1580      $("body").addClass("overflow-hidden");
1581      var themeDemosScrollObj = themeDemosObj.find(".demos-wrapper");
1582      var scrollOptions =
1583        themeDemosScrollObj.attr("data-scroll-options") ||
1584        '{ "theme": "dark" }';
1585      if (typeof scrollOptions !== "undefined" && scrollOptions !== null) {
1586        scrollOptions = $.parseJSON(scrollOptions);
1587        themeDemosScrollObj.mCustomScrollbar(scrollOptions);
1588      }
1589    } else {
1590      themeDemosObj.removeClass("active");
1591      $("body").removeClass("overflow-hidden");
1592    }
1593  });
1594
1595  /****** Non retina image code ******/
1596  $("img:not([data-at2x])").each(function () {
1597    $(this).attr("data-no-retina", "");
1598  });
1599
1600  /****** Window load ******/
1601  $(window).on("load", function () {
1602    /****** Parallax ******/
1603    setParallax();
1604
1605    /****** Page loader ******/
1606    if ($(".page-loader").length > 0) {
1607      $(".page-loader").fadeOut();
1608    }
1609
1610    /****** Reset isotope loop ******/
1611    resetIsotopeLayoutLoop(isotopeObjs, false);
1612
1613    /****** Reset swiper loop ******/
1614    resetSwiperLoop();
1615
1616    /****** Sticky footer ******/
1617    stickyFooter();
1618
1619    /***** Revolution slider navigation effect *****/
1620    RevolutionArrowEffect();
1621
1622    /***** Top overlap section position *****/
1623    setOverLayerPosition();
1624
1625    /****** Bottom overlap section position ******/
1626    setBottomOverLayerPosition();
1627  });
1628
1629  /****** Window resize ******/
1630  $(window).resize(function () {
1631    fullScreenHeight();
1632    destroySwiperLoop();
1633    resetSwiperLoop();
1634    stickyFooter();
1635
1636    setTimeout(function () {
1637      resetIsotopeLayoutLoop(isotopeObjs, true);
1638    }, 300);
1639
1640    setTimeout(function () {
1641      SetResizeContent();
1642      setOverLayerPosition();
1643      setBottomOverLayerPosition(100);
1644      initScrollNavigate();
1645    }, 500);
1646  }); // End resize event
1647
1648  /****** Window orientationchange ******/
1649  $(window).on("orientationchange", function (e) {
1650    // Close side menu
1651    $(".close-menu").trigger("click");
1652
1653    $(window).trigger("closemenu");
1654  });
1655
1656  /****** Closemenu ******/
1657  $(window).on("closemenu", function (e) {
1658    // Close all dropdown
1659    $(".dropdown").each(function () {
1660      var _this = $(this);
1661      _this.trigger("mouseleave");
1662      _this.removeClass("show");
1663      _this.children(".dropdown-menu").removeClass("show");
1664    });
1665
1666    // Close all menu
1667    if ($(".navbar-collapse").hasClass("show")) {
1668      $(".navbar-collapse").removeClass("show");
1669    }
1670    if ($("body").hasClass("navbar-collapse-show")) {
1671      $("body").removeClass("navbar-collapse-show");
1672      $("html").removeClass("overflow-hidden");
1673    }
1674
1675    // Close popup
1676    $(".search-close").trigger("click");
1677
1678    // Close theme demos
1679    if ($(".theme-demos").hasClass("active")) {
1680      $(".all-demo").trigger("click");
1681    }
1682  });
1683
1684  /****** Window scroll ******/
1685  $(window).on("scroll", initScrollNavigate);
1686
1687  /****** Window scroll function ******/
1688  function initScrollNavigate() {
1689    var scrollPos = $(window).scrollTop();
1690
1691    /****** One page navigation ******/
1692    var menuLinks = $(".navbar-nav li a");
1693    menuLinks.each(function () {
1694      var _this = $(this);
1695      var hasPos = _this.attr("href").indexOf("#");
1696      if (hasPos > -1) {
1697        var res = _this.attr("href").substring(hasPos);
1698        if (res != "" && res != "#" && $(res).length > 0) {
1699          var refElement = $(_this.attr("href"));
1700          if (
1701            refElement.position().top <= scrollPos + 60 &&
1702            refElement.position().top + refElement.height() > scrollPos + 60
1703          ) {
1704            menuLinks.removeClass("active");
1705            _this.addClass("active");
1706          }
1707          if (scrollPos < 1) {
1708            _this.removeClass("active");
1709          }
1710        }
1711      }
1712    });
1713
1714    /****** Sticky nav Start ******/
1715    var navHeight = 0,
1716      miniHeaderHeight = 0;
1717    if ($("nav").length > 0) {
1718      navHeight = $("nav").outerHeight();
1719    }
1720    if ($(".top-bar").length > 0) {
1721      miniHeaderHeight = $(".top-bar").outerHeight();
1722    }
1723    var headerHeight = navHeight + miniHeaderHeight;
1724    if (!$("header").hasClass("no-sticky")) {
1725      if (scrollPos >= headerHeight) {
1726        $("header").addClass("sticky");
1727        if (!$(".header-with-topbar .top-bar").is(":hidden")) {
1728          $(".header-with-topbar .top-bar").css({
1729            top: "-" + miniHeaderHeight + "px",
1730          });
1731          $(".header-with-topbar .fixed-top").css({ top: "0px" });
1732        }
1733      } else if (scrollPos <= headerHeight) {
1734        $(".header-with-topbar .top-bar").css({ top: "0px" });
1735        $(".header-with-topbar .fixed-top").css({
1736          top: miniHeaderHeight + "px",
1737        });
1738        $("header").removeClass("sticky");
1739        if (!$("header").hasClass("sticky")) {
1740          setTimeout(function () {
1741            setPageTitleSpace();
1742          }, 200);
1743        }
1744      }
1745    }
1746
1747    /****** Header appear on scroll up ******/
1748    if ($("nav.header-always-fixed-scroll").length <= 0) {
1749      var st = scrollPos;
1750      if (st > lastScroll) {
1751        st = st - 1;
1752        $(".sticky").removeClass("header-appear");
1753        $(".dropdown.on")
1754          .removeClass("on")
1755          .removeClass("show")
1756          .find(".dropdown-menu")
1757          .fadeOut(100);
1758      } else {
1759        $(".sticky").addClass("header-appear");
1760      }
1761      lastScroll = st;
1762      if (lastScroll <= navHeight) {
1763        $("header").removeClass("header-appear");
1764      }
1765    }
1766
1767    /****** Hide side menu on scroll ******/
1768    if (scrollPos >= 200 && getWindowWidth() > menuBreakPoint) {
1769      // Close all menu
1770      if ($(".navbar-collapse").hasClass("show")) {
1771        $(".navbar-collapse").removeClass("show");
1772      }
1773      if ($("body").hasClass("navbar-collapse-show")) {
1774        $("body").removeClass("navbar-collapse-show");
1775        $("html").removeClass("overflow-hidden");
1776      }
1777    }
1778
1779    /****** Scroll to top ******/
1780    if (scrollPos > 150) {
1781      $(".scroll-top-arrow").fadeIn("300");
1782      if (!$(".show-theme-demos").length && getWindowWidth() > 1199) {
1783        $(".theme-demos").fadeIn("300");
1784      }
1785    } else {
1786      $(".scroll-top-arrow").fadeOut("300");
1787    }
1788  }
1789
1790  /****** Check formatted number ******/
1791  function pad(d) {
1792    return d < 10 ? "0" + d.toString() : d.toString();
1793  }
1794
1795  /****** Check IE ******/
1796  function isIE() {
1797    var ua = window.navigator.userAgent,
1798      msie = ua.indexOf("MSIE ");
1799    if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
1800      return true;
1801    } else {
1802      return false;
1803    }
1804    return false;
1805  }
1806
1807  /****** Get window width ******/
1808  function getWindowWidth() {
1809    return $(window).width();
1810  }
1811
1812  /****** Get window height ******/
1813  function getWindowHeight() {
1814    return $(window).height();
1815  }
1816
1817  /****** Setup swiper slider ******/
1818  function setupSwiper() {
1819    /****** Swiper slider using params ******/
1820    var swiperItems = document.querySelectorAll(
1821      ".swiper-container:not( .instafeed-wrapper )",
1822    );
1823    swiperItems.forEach(function (swiperItem, index) {
1824      var _this = $(swiperItem),
1825        sliderOptions = _this.attr("data-slider-options");
1826      if (typeof sliderOptions !== "undefined" && sliderOptions !== null) {
1827        sliderOptions = $.parseJSON(sliderOptions);
1828
1829        /* If user have provided "data-slider-md-direction" attribute then below code will execute */
1830        var mdDirection = _this.attr("data-slider-md-direction");
1831        if (mdDirection != "" && mdDirection != undefined) {
1832          var direction =
1833            sliderOptions["direction"] != "" &&
1834            sliderOptions["direction"] != undefined
1835              ? sliderOptions["direction"]
1836              : mdDirection;
1837          sliderOptions["on"] = {
1838            init: function () {
1839              if (getWindowWidth() <= sliderBreakPoint) {
1840                this.changeDirection(mdDirection);
1841              } else {
1842                this.changeDirection(direction);
1843              }
1844              this.update();
1845            },
1846            resize: function () {
1847              if (getWindowWidth() <= sliderBreakPoint) {
1848                this.changeDirection(mdDirection);
1849              } else {
1850                this.changeDirection(direction);
1851              }
1852              this.update();
1853            },
1854          };
1855        }
1856
1857        /* If user have provided "data-thumb-slider-md-direction" attribute then below code will execute */
1858        if (
1859          sliderOptions["thumbs"] != "" &&
1860          sliderOptions["thumbs"] != undefined
1861        ) {
1862          var mdThumbDirection = _this.attr("data-thumb-slider-md-direction");
1863          if (mdThumbDirection != "" && mdThumbDirection != undefined) {
1864            var thumbDirection =
1865              sliderOptions["thumbs"]["swiper"]["direction"] != "" &&
1866              sliderOptions["thumbs"]["swiper"]["direction"] != undefined
1867                ? sliderOptions["thumbs"]["swiper"]["direction"]
1868                : mdThumbDirection;
1869            sliderOptions["thumbs"]["swiper"]["on"] = {
1870              init: function () {
1871                if (getWindowWidth() <= sliderBreakPoint) {
1872                  this.changeDirection(mdThumbDirection);
1873                } else {
1874                  this.changeDirection(thumbDirection);
1875                }
1876                this.update();
1877              },
1878              resize: function () {
1879                if (getWindowWidth() <= sliderBreakPoint) {
1880                  this.changeDirection(mdThumbDirection);
1881                } else {
1882                  this.changeDirection(thumbDirection);
1883                }
1884                this.update();
1885              },
1886              click: function () {
1887                /* Product thumbs automatic next / previous on click slide */
1888                if (this.activeIndex == this.clickedIndex) {
1889                  this.slidePrev();
1890                } else {
1891                  this.slideNext();
1892                }
1893              },
1894            };
1895          }
1896        }
1897
1898        /* If user have provided "data-slider-number-pagination" attribute then below code will execute */
1899        var numberPagination = _this.attr("data-slider-number-pagination");
1900        if (numberPagination != "" && numberPagination != undefined) {
1901          sliderOptions["on"]["slideChange"] = function () {
1902            if ($(".swiper-pagination-current").length > 0) {
1903              $(".swiper-pagination-current").html(pad(this.realIndex + 1, 2));
1904            }
1905            if ($(".swiper-pagination-total").length > 0) {
1906              $(".swiper-pagination-total").html(
1907                pad(this.slides.length - 2, 2),
1908              );
1909            }
1910          };
1911        }
1912
1913        /* If user have provided "data-slide-change-on-click" attribute then below code will execute */
1914        var changeOnClick = _this.attr("data-slide-change-on-click");
1915        if (changeOnClick != "" && changeOnClick != undefined) {
1916          sliderOptions["on"] = {
1917            click: function () {
1918              if (this.activeIndex > this.clickedIndex) {
1919                this.slidePrev();
1920              } else if (this.activeIndex < this.clickedIndex) {
1921                this.slideNext();
1922              }
1923            },
1924          };
1925        }
1926
1927        /* If user have provided "data-thumbs" attribute then below code will execute */
1928        var dataThumbs = _this.attr("data-thumbs");
1929        if (dataThumbs != "" && dataThumbs != undefined) {
1930          dataThumbs = $.parseJSON(dataThumbs);
1931          if (typeof dataThumbs !== "undefined" && dataThumbs !== null) {
1932            sliderOptions["pagination"]["renderBullet"] = function (
1933              index,
1934              className,
1935            ) {
1936              return (
1937                '<span class="' +
1938                className +
1939                '" style="background-image: url( ' +
1940                dataThumbs[index] +
1941                ' )"></span>'
1942              );
1943            };
1944          }
1945        }
1946
1947        var swiperObj = new Swiper(swiperItem, sliderOptions);
1948        swiperObjs.push(swiperObj);
1949      }
1950    });
1951  }
1952
1953  /****** Destroy swiper loop ******/
1954  function destroySwiperLoop() {
1955    for (var i = 0; i < swiperObjs.length; i++) {
1956      var swiperObj = swiperObjs[i],
1957        destroyWidth = swiperObj.$el.attr("data-slider-destroy");
1958      // If user have provided "data-slider-destroy" attribute then below code will execute
1959      if (destroyWidth != "" && destroyWidth != undefined) {
1960        if (getWindowWidth() <= destroyWidth) {
1961          swiperObj.destroy(false, true); // Destroy swiper
1962        } else if (swiperObj.destroyed) {
1963          swiperObjs.splice(i, 1);
1964          setupSwiper(); // Initialize swiper again
1965        }
1966      }
1967    }
1968  }
1969
1970  /****** Reset swiper loop ******/
1971  function resetSwiperLoop() {
1972    setTimeout(function () {
1973      for (var i = 0; i < swiperObjs.length; i++) {
1974        var swiperObj = swiperObjs[i];
1975        swiperObj.update();
1976      }
1977    }, 500);
1978  }
1979
1980  /****** Remove wow animation ******/
1981  function removeWowAnimation(gridObj) {
1982    gridObj
1983      .find(".grid-item")
1984      .removeClass("animate__animated")
1985      .css("visibility", ""); // avoid problem to filter after sorting
1986    if ($(".wow").length > 0) {
1987      gridObj.find(".grid-item").each(function () {
1988        var _this = $(this);
1989        // remove perticular element from WOW array when you don't want animation on element after DOM lead
1990        wow.removeBox(this);
1991        _this.css("-webkit-animation", "none");
1992        _this.css("-moz-animation", "none");
1993        _this.css("-ms-animation", "none");
1994        _this.css("animation", "none");
1995      });
1996    }
1997  }
1998
1999  /****** Reset isotope loop ******/
2000  function resetIsotopeLayoutLoop(isotopeObjs, removeAnimation) {
2001    for (var i = 0; i < isotopeObjs.length; i++) {
2002      if (removeAnimation) {
2003        removeWowAnimation(isotopeObjs[i]);
2004      }
2005      if (isotopeObjs[i].data("isotope")) {
2006        isotopeObjs[i].isotope("layout");
2007      }
2008    }
2009  }
2010
2011  /****** Top overlap section position ******/
2012  function setOverLayerPosition() {
2013    if (
2014      ($(".overlap-section").length > 0 ||
2015        $(".overlap-section-one-fourth").length > 0 ||
2016        $(".overlap-section-three-fourth").length > 0) &&
2017      getWindowWidth() >= 768
2018    ) {
2019      $(
2020        ".overlap-section, .overlap-section-one-fourth, .overlap-section-three-fourth",
2021      ).each(function () {
2022        var _this = $(this);
2023        setTimeout(function () {
2024          _this.imagesLoaded(function () {
2025            var closestSectionObj = _this.closest("section"),
2026              sectionPaddingTop = parseInt(
2027                closestSectionObj.css("padding-top"),
2028              ),
2029              areaHeight = _this.find("*").outerHeight(),
2030              overlayTop = areaHeight + sectionPaddingTop;
2031            if (_this.hasClass("overlap-section-one-fourth")) {
2032              overlayTop = areaHeight / 4 - overlayTop;
2033            } else if (_this.hasClass("overlap-section-three-fourth")) {
2034              overlayTop = (areaHeight * 3) / 4 - overlayTop;
2035            } else {
2036              overlayTop = areaHeight / 2 - overlayTop;
2037            }
2038            _this.css("margin-top", overlayTop);
2039            var parentSectionObj = closestSectionObj.prev(
2040                "section.overlap-height",
2041              ),
2042              overlapGap = parentSectionObj.find(".overlap-gap-section");
2043            parentSectionObj.imagesLoaded(function () {
2044              if (overlapGap.length > 0) {
2045                var gapSectionHeight =
2046                  overlapGap.outerHeight() +
2047                  (Math.abs(overlayTop) - sectionPaddingTop);
2048                overlapGap
2049                  .parents("section.overlap-height")
2050                  .height(gapSectionHeight);
2051              }
2052            });
2053          });
2054        }, 10);
2055      });
2056    } else {
2057      $(".overlap-height").height("");
2058      $(
2059        ".overlap-section, .overlap-section-one-fourth, .overlap-section-three-fourth",
2060      ).css("margin-top", "");
2061    }
2062  }
2063
2064  /****** Bottom overlap section position ******/
2065  function setBottomOverLayerPosition(delay) {
2066    if ($(".overlap-section-bottom").length > 0 && getWindowWidth() >= 768) {
2067      $(".overlap-section-bottom").each(function () {
2068        var _this = $(this),
2069          timeOut = _this.find(".instafeed-wrapper").length > 0 ? delay : 10;
2070        setTimeout(function () {
2071          _this.imagesLoaded(function () {
2072            var areaHeight = _this.outerHeight(),
2073              overlayerMargin = areaHeight / 2 - areaHeight;
2074            _this
2075              .parents("section")
2076              .next(".overlap-gap-section-bottom")
2077              .css("margin-top", overlayerMargin);
2078            _this
2079              .parents("section")
2080              .next(".overlap-gap-section-bottom")
2081              .css("padding-top", areaHeight);
2082          });
2083        }, timeOut);
2084      });
2085    } else {
2086      $(".overlap-gap-section-bottom").css("margin-top", "");
2087      $(".overlap-gap-section-bottom").css("padding-top", "");
2088    }
2089  }
2090
2091  /****** Counter ******/
2092  function animateCounters() {
2093    $(".counter").each(function (options) {
2094      var _this = $(this);
2095      options = $.extend({}, options || {}
2095, _this.data("countToOptions") || {});
2096      _this.countTo(options);
2097    });
2098  }
2099
2100  /****** Set parallax ******/
2101  function setParallax() {
2102    if (!isIE()) {
2103      $("[data-parallax-background-ratio]").each(function () {
2104        var ratio = $(this).attr("data-parallax-background-ratio") || 0.5;
2105        $(this).parallax("50%", ratio);
2106      });
2107      $("[data-parallax-layout-ratio]").each(function () {
2108        var ratio = $(this).attr("data-parallax-layout-ratio") || 1;
2109        $(this).parallaxImg(ratio);
2110      });
2111    }
2112  }
2113
2114  /****** Set vertical counter height******/
2115  function verticalCounterHeight() {
2116    $(".vertical-counter").each(function () {
2117      var _this = $(this),
2118        fontSize = _this.css("font-size");
2119      _this.css("height", fontSize);
2120      _this.find(".vertical-counter-number").each(function () {
2121        var __this = $(this),
2122          divHeight = __this.find("li").height();
2123        __this.height(divHeight);
2124      });
2125    });
2126  }
2127
2128  /****** Get top space header height ******/
2129  function getTopSpaceHeaderHeight() {
2130    var topSpaceHeaderHeight = 0;
2131    if ($("header nav.navbar").length > 0) {
2132      // Standard header
2133      topSpaceHeaderHeight =
2134        topSpaceHeaderHeight + $("header nav.navbar").outerHeight();
2135    }
2136    if ($(".top-bar").length > 0) {
2137      // Top bar
2138      topSpaceHeaderHeight = topSpaceHeaderHeight + $(".top-bar").outerHeight();
2139    }
2140    if (
2141      $(".sidebar-nav-action").length > 0 &&
2142      getWindowWidth() <= menuBreakPoint
2143    ) {
2144      // Left modern
2145      topSpaceHeaderHeight =
2146        topSpaceHeaderHeight + $(".sidebar-nav-action").outerHeight();
2147    }
2148    if (
2149      $(".side-menu-header").length > 0 &&
2150      getWindowWidth() <= menuBreakPoint
2151    ) {
2152      // Left classic
2153      topSpaceHeaderHeight =
2154        topSpaceHeaderHeight + $(".side-menu-header").outerHeight();
2155    }
2156    return topSpaceHeaderHeight;
2157  }
2158
2159  /****** Page title space ******/
2160  function setPageTitleSpace() {
2161    var topSpaceHeaderHeight = getTopSpaceHeaderHeight();
2162    if (
2163      !$(".navbar").hasClass("no-sticky") &&
2164      ($(".navbar").hasClass("top-space") ||
2165        $(".navbar").hasClass("mobile-top-space"))
2166    ) {
2167      $("body").css("padding-top", topSpaceHeaderHeight + "px");
2168    } else {
2169      $("body").css("padding-top", "");
2170    }
2171    if (
2172      $(".mobileoff-fullscreen-top-space").length >= 0 &&
2173      getWindowWidth() > 1023
2174    ) {
2175      $(".mobileoff-fullscreen-top-space").css(
2176        "height",
2177        getWindowHeight() - topSpaceHeaderHeight + "px",
2178      );
2179    }
2180    if ($(".fullscreen-top-space").length >= 0) {
2181      $(".fullscreen-top-space").css(
2182        "height",
2183        getWindowHeight() - topSpaceHeaderHeight + "px",
2184      );
2185    }
2186    if (
2187      $(".sidebar-nav-action").length > 0 ||
2188      $(".side-menu-header").length > 0
2189    ) {
2190      if (getWindowWidth() <= menuBreakPoint) {
2191        $("body").css("padding-top", topSpaceHeaderHeight + "px");
2192      } else {
2193        $("body").css("padding-top", "");
2194      }
2195    }
2196  }
2197
2198  /****** Full screen ******/
2199  function fullScreenHeight() {
2200    var fullScreenObj = $(".full-screen"),
2201      minHeight = getWindowHeight(),
2202      topSpaceHeaderHeight = getTopSpaceHeaderHeight();
2203    if (getWindowWidth() <= menuBreakPoint) {
2204      $("header nav.navbar").addClass("mobile-top-space");
2205      $(".sidebar-nav-action").addClass("mobile-top-space");
2206      $(".side-menu-header").addClass("mobile-top-space");
2207    } else {
2208      $("header nav.navbar").removeClass("mobile-top-space");
2209      $(".sidebar-nav-action").removeClass("mobile-top-space");
2210      $(".side-menu-header").removeClass("mobile-top-space");
2211    }
2212    fullScreenObj.parents("section").imagesLoaded(function () {
2213      if (
2214        $("section:first.full-screen, section:first .full-screen").length > 0 &&
2215        ($(".top-space").length > 0 || $(".mobile-top-space").length > 0)
2216      ) {
2217        $("section:first.full-screen, section:first .full-screen").css(
2218          "height",
2219          minHeight - topSpaceHeaderHeight,
2220        );
2221      } else if (
2222        $("header nav.navbar").hasClass("top-space") ||
2223        $("header nav.navbar").hasClass("mobile-top-space")
2224      ) {
2225        minHeight = minHeight - $("header nav.navbar").outerHeight();
2226        fullScreenObj.css("height", minHeight);
2227      } else {
2228        fullScreenObj.css("height", minHeight);
2229      }
2230    });
2231  }
2232
2233  /****** Mega menu resize ******/
2234  function megaMenuOnResize() {
2235    // Based on container / container-fluid width megamenu will open under parent menu as a center
2236    $("nav.navbar li.dropdown.megamenu").on(
2237      "touchstart mouseenter click",
2238      function (e) {
2239        var windowWidth = getWindowWidth();
2240        if (windowWidth > menuBreakPoint) {
2241          var dropdownMenuObj = $(this).children(".dropdown-menu");
2242          dropdownMenuObj.css({ left: "" });
2243          var menuSpacing = 30,
2244            dropdownMenuPadding = parseInt(dropdownMenuObj.css("padding-left")),
2245            linkPosition = $(this).position().left,
2246            linkWidth = $(this).outerWidth(),
2247            wrapperPosition = $(".navbar-collapse").offset().left,
2248            dropdownWidth = dropdownMenuObj.outerWidth();
2249          var actualLeftPosition =
2250            linkPosition + linkWidth / 2 - dropdownWidth / 2;
2251          var afterReducewrapperPosition = windowWidth - wrapperPosition;
2252          if (actualLeftPosition + wrapperPosition < 0) {
2253            actualLeftPosition = -wrapperPosition + menuSpacing;
2254          } else if (
2255            actualLeftPosition + dropdownWidth >
2256            afterReducewrapperPosition
2257          ) {
2258            actualLeftPosition =
2259              afterReducewrapperPosition - dropdownWidth - menuSpacing;
2260          }
2261          dropdownMenuObj.css({ left: actualLeftPosition + "px" });
2262        } else {
2263          $(this).children(".dropdown-menu").css({ right: "", left: "" });
2264        }
2265      },
2266    );
2267  }
2268
2269  /****** Menu position ******/
2270  function menuPosition(element) {
2271    var windowWidth = getWindowWidth();
2272    if (element.hasClass("simple-dropdown")) {
2273      simpleDropdown = element;
2274      linkDropdown = element.find("a.nav-link");
2275      var menuSpacing = 30,
2276        menuLeftPosition = element.offset().left,
2277        menuWidth = element.children(".dropdown-menu").outerWidth(),
2278        menuDropdownCSS =
2279          windowWidth - menuSpacing - (menuLeftPosition + menuWidth);
2280      if (menuDropdownCSS < 0) {
2281        element.children(".dropdown-menu").css("left", menuDropdownCSS);
2282      }
2283    }
2284    if (
2285      element.parent().hasClass("dropdown-menu") &&
2286      element.parents(".simple-dropdown")
2287    ) {
2288      var dropdownWidth = 0,
2289        maxValueInArray = 0,
2290        lastValue = 0,
2291        multiDepth = 0;
2292      dropdownWidth = element.outerWidth() - linkDropdown.outerWidth();
2293      element.find(".dropdown-menu").each(function () {
2294        var arr = [];
2295        if (element.find("li").hasClass("dropdown")) {
2296          dropdownWidth = dropdownWidth + element.outerWidth();
2297          element.find("li.dropdown").each(function () {
2298            var dropdownMenu = element.closest(".dropdown-menu");
2299            arr.push(dropdownMenu.outerWidth());
2300          });
2301          maxValueInArray = lastValue + Math.max.apply(Math, arr);
2302          lastValue = maxValueInArray;
2303          dropdownWidth = dropdownWidth + maxValueInArray;
2304          multiDepth = multiDepth + 1;
2305        } else if (multiDepth < 1) {
2306          dropdownWidth = dropdownWidth + element.outerWidth();
2307        }
2308      });
2309      var menuRightPosition =
2310        windowWidth -
2311        (simpleDropdown.offset().left + simpleDropdown.outerWidth());
2312      if (dropdownWidth > menuRightPosition) {
2313        if (element.find(".dropdown-menu").length > 0) {
2314          var menuTopPosition = element.position().top,
2315            submenuObj = element.find(".dropdown-menu"),
2316            submenuHeight = submenuObj.outerHeight(),
2317            totalHeight =
2318              menuTopPosition + submenuHeight + getTopSpaceHeaderHeight(),
2319            windowHeight = getWindowHeight();
2320          if (totalHeight > windowHeight) {
2321            submenuObj.css("top", "-" + (totalHeight - windowHeight) + "px");
2322          }
2323        }
2324        element.addClass("menu-left");
2325      }
2326    }
2327  }
2328
2329  /****** Sticky footer ******/
2330  function stickyFooter() {
2331    if ($(".footer-sticky").length > 0) {
2332      $(".footer-sticky").imagesLoaded(function () {
2333        var footerHeight = $(".footer-sticky").outerHeight();
2334        $(".main-content").css({ "margin-bottom": footerHeight });
2335      });
2336    }
2337    if ($(".box-layout").length > 0 && $(".footer-sticky").length > 0) {
2338      var boxLayoutObj = $(".box-layout"),
2339        boxLayoutwidth = boxLayoutObj.width();
2340      boxLayoutObj
2341        .find(".footer-sticky")
2342        .css({
2343          margin: "0 auto",
2344          width: boxLayoutwidth,
2345          "max-width": boxLayoutwidth,
2346        });
2347    }
2348  }
2349
2350  /* Get cookie function */
2351  function getCookie(cname) {
2352    var name = cname + "=";
2353    var decodedCookie = decodeURIComponent(document.cookie);
2354    var ca = decodedCookie.split(";");
2355    for (var i = 0; i < ca.length; i++) {
2356      var c = ca[i];
2357      while (c.charAt(0) == " ") {
2358        c = c.substring(1);
2359      }
2360      if (c.indexOf(name) == 0) {
2361        return c.substring(name.length, c.length);
2362      }
2363    }
2364    return "";
2365  }
2366
2367  /* Set cookie function */
2368  function setCookie(cname, cvalue, exdays) {
2369    var d = new Date();
2370    d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
2371    var expires = exdays != 0 && exdays != "" ? d.toUTCString() : 0;
2372    document.cookie = cname + "=" + cvalue + ";expires=" + expires + ";path=/";
2373  }
2374
2375  /****** Resize function call ******/
2376  function SetResizeContent() {
2377    setParallax();
2378    setPageTitleSpace();
2379    verticalCounterHeight();
2380  }
2381
2382  /***** Revolution slider navigation effect *****/
2383  function RevolutionArrowEffect() {
2384    if ($(".rev-nav-ares-effect").length > 0) {
2385      setTimeout(function () {
2386        $(".rev-nav-ares-effect .ares").css({ opacity: "1" });
2387      }, 2000);
2388    }
2389  }
2390
2391  /***** Submit form using AJAX *****/
2392  function submitAJAXForm(_this) {
2393    var formObj = _this.parents("form"),
2394      actionURL = formObj.attr("action"),
2395      resultsObj = formObj.find(".form-results"),
2396      redirectVal = formObj.find('[name="redirect"]').val();
2397
2398    if (actionURL != "" && actionURL != undefined) {
2399      _this.addClass("loading");
2400      $.ajax({
2401        type: "POST",
2402        url: actionURL,
2403        data: formObj.serialize(),
2404        success: function (result) {
2405          _this.removeClass("loading");
2406          if (redirectVal != "" && redirectVal != undefined) {
2407            window.location.href = redirectVal;
2408          } else {
2409            if (typeof result !== "undefined" && result !== null) {
2410              result = $.parseJSON(result);
2411            }
2412            formObj
2413              .find(
2414                "input[type=text],input[type=email],input[type=tel],input[type=password],textarea",
2415              )
2416              .each(function () {
2417                $(this).val("");
2418                $(this).removeClass("error");
2419              });
2420            formObj.find(".g-recaptcha").removeClass("error");
2421            formObj
2422              .find("input[type=checkbox],input[type=radio]")
2423              .prop("checked", false);
2424            if (formObj.find(".g-recaptcha").length > 0) {
2425              grecaptcha.reset();
2426            }
2427            formObj
2428              .find("input[name=action],input[name=g-recaptcha-response]")
2429              .remove();
2430            resultsObj
2431              .removeClass("alert-success")
2432              .removeClass("alert-danger")
2433              .hide();
2434            resultsObj.addClass(result.alert).html(result.message);
2435            resultsObj
2436              .removeClass("d-none")
2437              .fadeIn("slow")
2438              .delay(4000)
2439              .fadeOut("slow");
2440          }
2441        },
2442      });
2443    }
2444  }
2445
2446  /** State Facts open URL in new window */
2447  $(".state-links").change(function (event) {
2448    if (this.value !== "_null") {
2449      window.open(this.value, "_blank");
2450    }
2451  });
2452
2453  /** Partner Carousels */
2454  $(".partner-carousel").slick({
2455    slidesToShow: 1,
2456    slidesToScroll: 1,
2457    autoplay: true,
2458    autoplaySpeed: 3000,
2459    infinite: true,
2460  });
2461})(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.