PageSourceSearch

https://www.corequestyoga.com/files/theme/custom.js?1556897694

js corequestyoga.com collected 2026-10-06 20:54:29 UTC 3,999 bytes, 143 lines download raw bytes

1jQuery(function($) {
2
3  // Fixed nav
4  $.fn.checkElementPositioning = function($el, $offsetHeightEl, scrollClass) {
5    if (!this.length) {
6      return;
7    }
8
9    if(((this.offset().top - $(window).scrollTop()) <= $offsetHeightEl.outerHeight()) && !$el.hasClass(scrollClass)) {
10      $el.addClass(scrollClass);
11    } else if(((this.offset().top - $(window).scrollTop()) >= $offsetHeightEl.outerHeight()) && $el.hasClass(scrollClass)) {
12      $el.removeClass(scrollClass);
13    }
14  }
15
16  // Mobile sidebars
17  $.fn.expandableSidebar = function(expandedClass) {
18    var $me = this;
19
20    $me.on('click', function() {
21      if(!$me.hasClass(expandedClass)) {
22        $me.addClass(expandedClass);
23      } else {
24        $me.removeClass(expandedClass);
25      }
26    });
27  }
28
29  var impactController = {
30    init: function(opts) {
31      var base = this;
32
33      // Add classes to elements
34      base._addClasses();
35      base._attachEvents();
36      
37      setTimeout(function(){
38        base._checkCartItems(); 
39      }, 1000);
40    },
41
42    _addClasses: function() {
43      var base = this;
44
45      // Add placeholder text to inputs
46      $('.wsite-form-sublabel').each(function(){
47        var sublabel = $(this).text();
48        $(this).prev('.wsite-form-input').attr('placeholder', sublabel);
49      });
50
51      // Add fullwidth class to gallery thumbs if less than 6
52      $('.imageGallery').each(function(){
53        if ($(this).children('div').length <= 6) {
54          $(this).children('div').addClass('fullwidth-mobile');
55        }
56      });
57    },
58
59    _stickyFooter: function() {    
60      var stickyFooterMargin = $('#footer-wrap').height();
61      
62      $('.wrapper').css('margin-bottom', -stickyFooterMargin);
63      $('#footer-wrap, .sticky-footer-push').css('height', stickyFooterMargin);
64    },
65
66    _checkCartItems: function() {
67      var base = this;
68      
69      if($('#wsite-mini-cart').find('li.wsite-product-item').length > 0) {
70        $('body').addClass('cart-full');
71      } else {
72        $('body').removeClass('cart-full');
73      }
74    },
75
76    _attachEvents: function() {
77      var base = this;
78
79        // Nav toggle
80        $('.hamburger').on('click', function(e) {
81            e.preventDefault();
82            if(!$('body').hasClass('nav-open')) {
83                $('body').addClass('nav-open');
84            } else {
85                $('body').removeClass('nav-open');
86            }
87        });
88
89      $(window).on('scroll', function(){
90
91        // Affix nav
92        if($('body.page-has-banner').length > 0) {
93          $('.banner-wrap').checkElementPositioning($('body'), $('.menu-controls-wrap'), 'affix');
94        } else {
95          $('.main-wrap').checkElementPositioning($('body'), $('.menu-controls-wrap'), 'affix');
96        }
97      });
98
99      // Store category dropdown
100      $('.wsite-com-sidebar').expandableSidebar('sidebar-expanded');
101
102      // Search filters dropdown
103      $('#wsite-search-sidebar').expandableSidebar('sidebar-expanded');
104
105      // Init fancybox swipe on mobile
106      if('ontouchstart' in window) {
107        $('body').on('click', 'a.w-fancybox', function() {
108          base._initSwipeGallery();
109        });
110      }
111
112      // Init sticky footer
113      if($(window).width() > 767) {
114        base._stickyFooter();
115      }
116
117      // Copy login to mobile nav
118		var login = $("#member-login").clone(true);
119		$("#navmobile .wsite-menu-default").append(login);
120    },
121
122    _initSwipeGallery: function() {
123      var base = this;
124
125      setTimeout(function(){
126        var touchGallery = document.getElementsByClassName('fancybox-wrap')[0];
127        var mc = new Hammer(touchGallery);
128        mc.on("panleft panright", function(ev) {
129          if (ev.type == "panleft") {
130            $("a.fancybox-next").trigger("click");
131          } else if (ev.type == "panright") {
132            $("a.fancybox-prev").trigger("click");
133          }
134          base._initSwipeGallery();
135        });
136      }, 500);
137    }
138  }
139
140  $(document).ready(function(){
141    impactController.init();
142  });
143});

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.