PageSourceSearch

https://www.mexcarepharmacy.co.uk/assets/js/main.js

js mexcarepharmacy.co.uk collected 2026-10-05 23:52:03 UTC 21,123 bytes, 840 lines download raw bytes

1;(function($){
2
3$(document).ready(function(){
4
5//========== HEADER ACTIVE STRATS ============= //
6function initHeaderSticky() {
7  var windowOn = $(window);
8  windowOn.on('scroll', function () {
9    var scroll = windowOn.scrollTop();
10    if (scroll < 100) {
11      $(".vl-header-area").removeClass("header-sticky");
12    } else {
13      $(".vl-header-area").addClass("header-sticky");
14    }
15  });
16}
17initHeaderSticky();
18//========== HEADER ACTIVE ENDS ============= //
19
20//========== MOBILE MENU STARTS ============= //
21function initOffcanvasMenu() {
22  var vlMenuWrap = $('.vl-mobile-menu-active > ul').clone();
23  var vlSideMenu = $('.vl-offcanvas-menu nav');
24  vlSideMenu.append(vlMenuWrap);
25
26  if ($(vlSideMenu).find('.sub-menu, .vl-mega-menu').length !== 0) {
27    $(vlSideMenu).find('.sub-menu, .vl-mega-menu').parent().append('<button class="vl-menu-close"><i class="fas fa-chevron-right"></i></button>');
28  }
29
30  var sideMenuList = $('.vl-offcanvas-menu nav > ul > li button.vl-menu-close, .vl-offcanvas-menu nav > ul li.has-dropdown > a');
31  $(sideMenuList).on('click', function (e) {
32    e.preventDefault();
33    if (!$(this).parent().hasClass('active')) {
34      $(this).parent().addClass('active');
35      $(this).siblings('.sub-menu, .vl-mega-menu').slideDown();
36    } else {
37      $(this).siblings('.sub-menu, .vl-mega-menu').slideUp();
38      $(this).parent().removeClass('active');
39    }
40  });
41
42  $(".vl-offcanvas-toggle").on('click', function () {
43    $(".vl-offcanvas").addClass("vl-offcanvas-open");
44    $(".vl-offcanvas-overlay").addClass("vl-offcanvas-overlay-open");
45  });
46
47  $(".vl-offcanvas-close-toggle, .vl-offcanvas-overlay").on('click', function () {
48    $(".vl-offcanvas").removeClass("vl-offcanvas-open");
49    $(".vl-offcanvas-overlay").removeClass("vl-offcanvas-overlay-open");
50  });
51}
52
53initOffcanvasMenu();
54//========== MOBILE MENU ENDS ============= //
55
56//========== SIDEBAR/SEARCH AREA ============= //
57function initHeaderSearchPopup() {
58  $(".header-search-btn").on("click", function (e) {
59    e.preventDefault();
60    $(".header-search-form-wrapper").addClass("open");
61    $('.header-search-form-wrapper input[type="search"]').focus();
62    $('.body-overlay').addClass('active');
63  });
64
65  $(".tx-search-close").on("click", function (e) {
66    e.preventDefault();
67    $(".header-search-form-wrapper").removeClass("open");
68    $("body").removeClass("active");
69    $('.body-overlay').removeClass('active');
70  });
71}
72initHeaderSearchPopup();
73//========== SIDEBAR/SEARCH AREA ============= //
74
75//========== PAGE PROGRESS STARTS ============= // 
76function initScrollProgress() {
77  var progressPath = document.querySelector(".progress-wrap path");
78  if (!progressPath) return;
79  var pathLength = progressPath.getTotalLength();
80  progressPath.style.transition = progressPath.style.WebkitTransition = "none";
81  progressPath.style.strokeDasharray = pathLength + " " + pathLength;
82  progressPath.style.strokeDashoffset = pathLength;
83  progressPath.getBoundingClientRect();
84  progressPath.style.transition = progressPath.style.WebkitTransition = "stroke-dashoffset 10ms linear";
85  var updateProgress = function () {
86    var scroll = $(window).scrollTop();
87    var height = $(document).height() - $(window).height();
88    var progress = pathLength - (scroll * pathLength) / height;
89    progressPath.style.strokeDashoffset = progress;
90  };
91  updateProgress();
92  $(window).on('scroll', updateProgress);
93  var offset = 50;
94  var duration = 550;
95  $(window).on("scroll", function () {
96    if ($(this).scrollTop() > offset) {
97      $(".progress-wrap").addClass("active-progress");
98    } else {
99      $(".progress-wrap").removeClass("active-progress");
100    }
101  });
102  $(".progress-wrap").on("click", function (event) {
103    event.preventDefault();
104    $("html, body").animate({ scrollTop: 0 }, duration);
105    return false;
106  });
107}
108initScrollProgress();
109//========== PAGE PROGRESS STARTS ============= // 
110
111//========== VIDEO POPUP STARTS ============= //
112function initYoutubePopup() {
113  var youtubePopup = $(".popup-youtube");
114  if (youtubePopup.length > 0) {
115    youtubePopup.magnificPopup({
116      type: "iframe",
117    });
118  }
119}
120initYoutubePopup();
121//========== VIDEO POPUP ENDS ============= //
122AOS.init;
123AOS.init({disable: 'mobile'});
124
125//========== NICE SELECT ============= //
126// $('select').niceSelect();
127$('select').not('.flatpickr-monthDropdown-months').niceSelect();
128
129//========== CASE IMAGE ============= //
130function initHoverActive() {
131  $('.cs_hover_active').hover(function () {
132    $(this).addClass('active').siblings().removeClass('active');
133  });
134}
135initHoverActive();
136
137});
138//========== COUNTER UP============= //
139function initCounterUp() {
140  const ucounter = $('.counter');
141  if (ucounter.length > 0) {
142    ucounter.countUp();
143  }
144}
145initCounterUp();
146//========== TESTIMONIAL AREA ============= //
147
148// SLIDER //
149$(".testimonial-single-slider").slick({
150  slidesToShow: 1,
151  slidesToScroll: 1,
152  arrows: true,
153  prevArrow: $(".testimonial-prev-arrow"),
154  nextArrow: $(".testimonial-next-arrow"),
155  loop: true,
156  autoplay:true,
157  autoplayTimeout:500,
158});
159
160// SLIDER //
161$(".testimonial-single-slider3").slick({
162  slidesToShow: 1,
163  slidesToScroll: 1,
164  arrows: true,
165  prevArrow: $(".prev-arrow"),
166  nextArrow: $(".next-arrow"),
167  loop: true,
168  autoplay:true,
169  autoplayTimeout:500,
170});
171
172// SLIDER //
173$('.team-single-slider').owlCarousel({
174  loop:true,
175  margin:30,
176  nav:true,
177  dots:true,
178  items:10,
179  navText:["<i class='fa-solid fa-angle-left'></i>" , "<i class='fa-solid fa-angle-right'></i>"],
180  autoplay:true,
181  smartSpeed:2000,
182  autoplayTimeout:3000,
183  responsiveClass:true,
184  responsive:{
185      0:{
186          items:1,
187      },
188      600:{
189          items:2,
190      },
191      1000:{
192          items:3,
193      }
194  }
195});
196
197// SLIDER //
198$('.team-single-slider2').owlCarousel({
199  loop:true,
200  margin:30,
201  nav:true,
202  dots:false,
203  items:10,
204  navText:["<i class='fa-solid fa-angle-left'></i>" , "<i class='fa-solid fa-angle-right'></i>"],
205  autoplay:true,
206  smartSpeed:2000,
207  autoplayTimeout:3000,
208  responsiveClass:true,
209  responsive:{
210      0:{
211          items:1,
212      },
213      600:{
214          items:2,
215      },
216      1000:{
217          items:3,
218      }
219  }
220});
221
222// SLIDER //
223$('.service-single-slider').owlCarousel({
224  loop:true,
225  margin:30,
226  nav:true,
227  dots:true,
228  items:10,
229  navText:["<i class='fa-solid fa-angle-left'></i>" , "<i class='fa-solid fa-angle-right'></i>"],
230  autoplay:true,
231  smartSpeed:2000,
232  autoplayTimeout:3000,
233  responsiveClass:true,
234  responsive:{
235      0:{
236          items:1,
237      },
238      600:{
239          items:2,
240      },
241      1000:{
242          items:3,
243      }
244  }
245});
246
247// SLIDER //
248$('.testimonial-single-slider2').owlCarousel({
249  loop:true,
250  margin:30,
251  nav:true,
252  dots:true,
253  items:10,
254  navText:["<i class='fa-solid fa-angle-left'></i>" , "<i class='fa-solid fa-angle-right'></i>"],
255  autoplay:true,
256  smartSpeed:2000,
257  autoplayTimeout:3000,
258  responsiveClass:true,
259  responsive:{
260      0:{
261          items:1,
262      },
263      600:{
264          items:2,
265      },
266      1000:{
267          items:2,
268      }
269  }
270});
271
272// SLIDER //
273$(".hero-main-slider").slick({
274  autoplay:true,
275  autoplaySpeed:2000,
276  speed:1500,
277  slidesToShow:1,
278  slidesToScroll:1,
279  pauseOnHover:false,
280  dots:false,
281  arrows:true,
282  pauseOnDotsHover:true,
283  cssEase:'linear',
284  fade:true,
285  draggable:true,
286  prevArrow: $(".testimonial-prev-arrow"),
287  nextArrow: $(".testimonial-next-arrow"), 
288}); 
289
290
291// SLIDER //
292$('.team-box-slider').owlCarousel({
293  loop:true,
294  margin:30,
295  nav:true,
296  dots:true,
297  items:10,
298  navText:["<i class='fa-solid fa-angle-left'></i>" , "<i class='fa-solid fa-angle-right'></i>"],
299  autoplay:true,
300  smartSpeed:2000,
301  autoplayTimeout:3000,
302  responsiveClass:true,
303  responsive:{
304      0:{
305          items:1,
306      },
307      600:{
308          items:2,
309      },
310      1000:{
311          items:4,
312      }
313  }
314});
315
316// SLIDER //
317$('.team4-slider-area').owlCarousel({
318  loop:true,
319  margin:30,
320  nav:false,
321  dots:true,
322  items:10,
323  autoplay:true,
324  smartSpeed:2000,
325  autoplayTimeout:3000,
326  responsiveClass:true,
327  responsive:{
328      0:{
329          items:1,
330      },
331      600:{
332          items:2,
333      },
334      1000:{
335          items:4,
336      }
337  }
338});
339
340// SLIDER //
341$('.service4-slider-area').owlCarousel({
342  loop:true,
343  margin:30,
344  nav:false,
345  dots:true,
346  items:10,
347  autoplay:true,
348  smartSpeed:2000,
349  autoplayTimeout:3000,
350  responsiveClass:true,
351  responsive:{
352      0:{
353          items:1,
354      },
355      600:{
356          items:2,
357      },
358      1000:{
359          items:4,
360      }
361  }
362});
363
364// SLIDER //
365$('.testimonial4-slider-area').owlCarousel({
366  loop:true,
367  margin:30,
368  nav:false,
369  dots:true,
370  items:10,
371  autoplay:true,
372  smartSpeed:2000,
373  autoplayTimeout:3000,
374  responsiveClass:true,
375  responsive:{
376      0:{
377          items:1,
378      },
379      600:{
380          items:2,
381      },
382      1000:{
383          items:3,
384      }
385  }
386});
387
388// SLIDER //
389$('.shop-single-slider').owlCarousel({
390  loop:true,
391  margin:30,
392  nav:true,
393  dots:false,
394  items:10,
395  autoplay:true,
396  navText:["<i class='fa-solid fa-angle-left'></i>" , "<i class='fa-solid fa-angle-right'></i>"],
397  smartSpeed:2000,
398  autoplayTimeout:3000,
399  responsiveClass:true,
400  responsive:{
401      0:{
402          items:1,
403      },
404      600:{
405          items:2,
406      },
407      1000:{
408          items:4,
409      }
410  }
411});
412
413// SLIDER //
414$('.blog-slider-area').owlCarousel({
415  loop:true,
416  margin:30,
417  nav:true,
418  dots:false,
419  items:10,
420  autoplay:true,
421  navText:["<i class='fa-solid fa-angle-left'></i>" , "<i class='fa-solid fa-angle-right'></i>"],
422  smartSpeed:2000,
423  autoplayTimeout:3000,
424  responsiveClass:true,
425  responsive:{
426      0:{
427          items:1,
428      },
429      600:{
430          items:2,
431      },
432      1000:{
433          items:3,
434      }
435  }
436});
437
438// SLIDER //
439$('.testimonial7-slider-boxarea').owlCarousel({
440  loop:true,
441  margin:30,
442  nav:true,
443  dots:false,
444  fade:true,
445  items:10,
446  autoplay:true,
447  navText:["<i class='fa-solid fa-angle-left'></i>" , "<i class='fa-solid fa-angle-right'></i>"],
448  smartSpeed:2000,
449  autoplayTimeout:3000,
450  responsiveClass:true,
451  responsive:{
452      0:{
453          items:1,
454      },
455      600:{
456          items:1,
457      },
458      1000:{
459          items:1,
460      }
461  }
462});
463
464// SLIDER //
465$('.team-slide-widget').owlCarousel({
466  loop:true,
467  margin:30,
468  nav:false,
469  dots:true,
470  fade:true,
471  items:10,
472  autoplay:true,
473  smartSpeed:2000,
474  autoplayTimeout:3000,
475  responsiveClass:true,
476  responsive:{
477      0:{
478          items:1,
479      },
480      600:{
481          items:2,
482      },
483      1000:{
484          items:4,
485      }
486  }
487});
488
489// SLIDER //
490$(".testimonial8-imges").slick({
491  slidesToShow: 1,
492  slidesToScroll: 1,
493  arrows: false,
494  autoplay:true,
495  autoplaySpeed:2000,
496  loop: true,
497  focusOnSelect: true,
498  vertical:false,
499  asNavFor: ".testimonial-content-slider",
500  infinite: true,
501  fade:true,
502});
503
504$(".testimonial-content-slider").slick({
505  slidesToShow: 1,
506  slidesToScroll: 1,
507  asNavFor: ".testimonial8-imges",
508  dots: false,
509  arrows: true,
510  centerMode: false,
511  focusOnSelect: true,
512  loop: true,
513  autoplay:true,
514  autoplaySpeed:2000,
515  prevArrow: $(".testimonial-prev-arrow"),
516  nextArrow: $(".testimonial-next-arrow"), 
517});
518
519// SLIDER //
520$('.hero8-images-area').owlCarousel({
521  loop:true,
522  margin:30,
523  nav:true,
524  dots:false,
525  navText:["<i class='fa-solid fa-angle-left'></i>" , "<i class='fa-solid fa-angle-right'></i>"],
526  fade:true,
527  items:10,
528  animateOut: 'fadeOut',
529  animateIn: 'fadeIn',
530  autoplay:true,
531  smartSpeed:2000,
532  autoplayTimeout:3000,
533  responsiveClass:true,
534  responsive:{
535      0:{
536          items:1,
537      },
538      600:{
539          items:1,
540      },
541      1000:{
542          items:1,
543      }
544  }
545});
546
547// SLIDER //
548$('.team6-slider-widget').owlCarousel({
549  loop:true,
550  margin:30,
551  nav:true,
552  dots:false,
553  navText:["<i class='fa-solid fa-arrow-left'></i>" , "<i class='fa-solid fa-arrow-right'></i>"],
554  fade:true,
555  items:10,
556  autoplay:true,
557  smartSpeed:2000,
558  autoplayTimeout:3000,
559  responsiveClass:true,
560  responsive:{
561      0:{
562          items:1,
563      },
564      600:{
565          items:2,
566      },
567      1000:{
568          items:4,
569      }
570  }
571});
572
573// SLIDER //
574$('.testimonial8-widgetarea ').owlCarousel({
575  loop:true,
576  margin:30,
577  nav:true,
578  dots:false,
579  navText:["<i class='fa-solid fa-arrow-left'></i>" , "<i class='fa-solid fa-arrow-right'></i>"],
580  fade:true,
581  items:10,
582  autoplay:true,
583  smartSpeed:2000,
584  autoplayTimeout:3000,
585  responsiveClass:true,
586  responsive:{
587      0:{
588          items:1,
589      },
590      600:{
591          items:1,
592      },
593      1000:{
594          items:1,
595      }
596  }
597});
598
599// SLIDER //
600$('.case-slider-area').owlCarousel({
601  loop:true,
602  margin:30,
603  nav:true,
604  dots:false,
605  navText:["<i class='fa-solid fa-arrow-left'></i>" , "<i class='fa-solid fa-arrow-right'></i>"],
606  fade:true,
607  items:10,
608  autoplay:true,
609  smartSpeed:2000,
610  autoplayTimeout:3000,
611  responsiveClass:true,
612  responsive:{
613      0:{
614          items:1,
615      },
616      600:{
617          items:2,
618      },
619      1000:{
620          items:3,
621      }
622  }
623});
624//========== PRELOADER ============= //
625function initPreloader() {
626  $(window).on("load", function () {
627    setTimeout(function () {
628      $(".cs_preloader").fadeToggle();
629    }, 200);
630  });
631}
632initPreloader();
633
634
635})(jQuery);
636
637
638//========== GSAP AREA ============= //
639function initTextAnimation() {
640  if ($('.text-anime-style-1').length) {
641    let staggerAmount = 0.05,
642        translateXValue = 0,
643        delayValue = 0.5,
644        animatedTextElements = document.querySelectorAll('.text-anime-style-1');
645
646    animatedTextElements.forEach((element) => {
647      let animationSplitText = new SplitText(element, { type: "chars, words" });
648      gsap.from(animationSplitText.words, {
649        duration: 1,
650        delay: delayValue,
651        x: 20,
652        autoAlpha: 0,
653        stagger: staggerAmount,
654        scrollTrigger: { trigger: element, start: "top 85%" },
655      });
656    });
657  }
658}
659initTextAnimation();
660
661function initTextAnimationStyle2() {
662  if ($('.text-anime-style-2').length) {
663    let staggerAmount = 0.05,
664        translateXValue = 20,
665        delayValue = 0.5,
666        easeType = "power2.out",
667        animatedTextElements = document.querySelectorAll('.text-anime-style-2');
668
669    animatedTextElements.forEach((element) => {
670      let animationSplitText = new SplitText(element, { type: "chars, words" });
671      gsap.from(animationSplitText.chars, {
672        duration: 1,
673        delay: delayValue,
674        x: translateXValue,
675        autoAlpha: 0,
676        stagger: staggerAmount,
677        ease: easeType,
678        scrollTrigger: { trigger: element, start: "top 85%" },
679      });
680    });
681  }
682}
683
684initTextAnimationStyle2();
685
686function initTextAnimationStyle3() {
687  if ($('.text-anime-style-3').length) {
688    let animatedTextElements = document.querySelectorAll('.text-anime-style-3');
689
690    animatedTextElements.forEach((element) => {
691      if (element.animation) {
692        element.animation.progress(1).kill();
693        element.split.revert();
694      }
695      element.split = new SplitText(element, {
696        type: "lines,words,chars",
697        linesClass: "split-line",
698      });
699      gsap.set(element, { perspective: 400 });
700      gsap.set(element.split.chars, { opacity: 0, x: "50" });
701      element.animation = gsap.to(element.split.chars, {
702        scrollTrigger: { trigger: element, start: "top 90%" },
703        x: "0",
704        y: "0",
705        rotateX: "0",
706        opacity: 1,
707        duration: 1,
708        ease: Back.easeOut,
709        stagger: 0.02,
710      });
711    });
712  }
713}
714initTextAnimationStyle3();
715
716
717function initRevealAnimation() {
718  if ($('.reveal').length) {
719    gsap.registerPlugin(ScrollTrigger);
720
721    let revealContainers = document.querySelectorAll(".reveal");
722
723    revealContainers.forEach((container) => {
724      let image = container.querySelector("img");
725      
726      let tl = gsap.timeline({
727        scrollTrigger: {
728          trigger: container,
729          toggleActions: "play none none none",
730        }
731      });
732      tl.set(container, { autoAlpha: 1 });
733      tl.from(container, 1.5, { xPercent: -100, ease: Power2.out });
734      tl.from(image, 1.5, { xPercent: 100, scale: 1.3, delay: -1.5, ease: Power2.out });
735    });
736  }
737}
738
739initRevealAnimation();
740
741
742
743//========== FILTER IMAGE ============= //
744jQuery(document).ready(function($){
745  var dragging = false,
746      scrolling = false,
747      resizing = false;
748  
749  var imageComparisonContainers = $('.cd-image-container');
750
751  checkPosition(imageComparisonContainers);
752
753  $(window).on('scroll', function(){
754      if( !scrolling) {
755          scrolling = true;
756          requestAnimationFrame(function(){ checkPosition(imageComparisonContainers); });
757      }
758  });
759
760  imageComparisonContainers.each(function(){
761      var container = $(this);
762      drags(container.find('.cd-handle'), container.find('.cd-resize-img'), container, 
763           container.find('.cd-image-label[data-type="original"]'), 
764           container.find('.cd-image-label[data-type="modified"]'));
765  });
766
767  $(window).on('resize', function(){
768      if( !resizing) {
769          resizing = true;
770          requestAnimationFrame(function(){ checkLabel(imageComparisonContainers); });
771      }
772  });
773
774  function checkPosition(container) {
775      container.each(function(){
776          var actualContainer = $(this);
777          if( $(window).scrollTop() + $(window).height() * 0.5 > actualContainer.offset().top) {
778              actualContainer.addClass('is-visible');
779          }
780      });
781      scrolling = false;
782  }
783
784  function checkLabel(container) {
785      container.each(function(){
786          var actual = $(this);
787          updateLabel(actual.find('.cd-image-label[data-type="modified"]'), actual.find('.cd-resize-img'), 'left');
788          updateLabel(actual.find('.cd-image-label[data-type="original"]'), actual.find('.cd-resize-img'), 'right');
789      });
790      resizing = false;
791  }
792
793  function drags(dragElement, resizeElement, container, labelContainer, labelResizeElement) {
794      dragElement.on("mousedown vmousedown", function(e) {
795          dragElement.addClass('draggable1');
796          resizeElement.addClass('resizable1');
797
798          var dragWidth = dragElement.outerWidth(),
799              xPosition = dragElement.offset().left + dragWidth - e.pageX,
800              containerOffset = container.offset().left,
801              containerWidth = container.outerWidth(),
802              minLeft = containerOffset + 10,
803              maxLeft = containerOffset + containerWidth - dragWidth - 10;
804          dragElement.parents().on("mousemove vmousemove", function(e) {
805              if( !dragging) {
806                  dragging = true;
807                  requestAnimationFrame(function(){ animateDraggedHandle(e, xPosition, dragWidth, minLeft, maxLeft, containerOffset, containerWidth, resizeElement, labelContainer, labelResizeElement); });
808              }
809          }).on("mouseup vmouseup", function(e){
810              dragElement.removeClass('draggable1');
811              resizeElement.removeClass('resizable1');
812          });
813          e.preventDefault();
814      }).on("mouseup vmouseup", function(e) {
815          dragElement.removeClass('draggable1');
816          resizeElement.removeClass('resizable1');
817      });
818  }
819
820  function animateDraggedHandle(e, xPosition, dragWidth, minLeft, maxLeft, containerOffset, containerWidth, resizeElement, labelContainer, labelResizeElement) {
821      var leftValue = e.pageX + xPosition - dragWidth;   
822      leftValue = Math.max(minLeft, Math.min(leftValue, maxLeft));
823
824      var widthValue = (leftValue + dragWidth / 2 - containerOffset) * 100 / containerWidth + '%';
825      $('.draggable1').css('left', widthValue);
826      $('.resizable1').css('width', widthValue);
827      updateLabel(labelResizeElement, resizeElement, 'left');
828      updateLabel(labelContainer, resizeElement, 'right');
829
830      dragging = false;
831  }
832
833  function updateLabel(label, resizeElement, position) {
834      if(position === 'left') {
835          (label.offset().left + label.outerWidth() < resizeElement.offset().left + resizeElement.outerWidth()) ? label.removeClass('is-hidden') : label.addClass('is-hidden');
836      } else {
837          (label.offset().left > resizeElement.offset().left + resizeElement.outerWidth()) ? label.removeClass('is-hidden') : label.addClass('is-hidden');
838      }
839  }
840});

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.