PageSourceSearch

https://blakelands.co.uk/wp-content/themes/organic-stax/assets/js/jquery.custom.js?ver=1.0

js blakelands.co.uk collected 2026-10-04 08:21:23 UTC 5,937 bytes, 157 lines download raw bytes

1(function ($) {
2  'use strict'
3
4  function generalFunctions() {
5    // Start Marquee
6    $('.marquee').each(function () {
7      var $this = $(this); // Store the current .marquee
8      for(var i = 0; i < 1; i++) {
9        var $cloneOfGroup = $this.find('.marquee__group:first').clone(); // Clone the first .marquee__group
10        // Add aria-hidden to all elements in the clone
11        $cloneOfGroup.find('*').attr('aria-hidden', 'true');
12        // Append the clone to the current .marquee
13        $this.append($cloneOfGroup);
14      }
15    });
16    $('.marquee .marquee__group').each(function () {
17      var $this = $(this); // Store the current .marquee__group
18      for(var i = 0; i < 1; i++) {
19        var $cloneOfText = $this.contents().clone().attr('aria-hidden', 'true'); // Clone the text and add aria-hidden
20        // Append the cloned text to the current .marquee__group
21        $this.append($cloneOfText);
22      }
23    });
24
25    // Filters Panel
26    // Initially hide the filters-panel
27    $(".filters-panel").css({
28      'right': '-100%',
29      'position': 'fixed'
30    });
31    // Open the filters-panel
32    $(".product-filter-button").click(function() {
33      $(".filters-panel").animate({
34        right: '0'
35      });
36    });
37    // Close the filters-panel
38    $(".product-filter-close").click(function() {
39      $(".filters-panel").animate({
40        right: '-100%'
41      });
42    });
43  }
44
45  /* Animate On Scroll --------------------- */
46  function animateScroll() { 
47    // Get all elements that have a class containing 'animate__'
48    var elements = $('[class*=animate__]');
49
50    // Initially set animation-play-state to paused for all elements
51    elements.css('animation-play-state', 'paused');
52
53    var delay = 0;  // Initialize delay
54    var prevEntry = null;  // Keep track of the previous entry
55
56    var observer = new IntersectionObserver(function(entries) {
57      entries.forEach(function(entry) {
58        var $el = $(entry.target);
59
60        if (entry.isIntersecting) {
61          // If the current entry is not immediately after the previous one, reset the delay
62          if (prevEntry && $el.prev()[0] !== prevEntry.target) {
63            delay = 0;
64          }
65          
66          // Element is visible, add class, apply delay, and set animation-play-state to running
67          $el.addClass('animate__animated')
68            .css({
69              'animation-delay': delay + 's',
70              'animation-play-state': 'running'
71            });
72
73          // Unobserve the element so animation doesn't repeat
74          observer.unobserve(entry.target);
75
76          // Increase delay
77          delay += 0.25;
78
79          // Update the previous entry
80          prevEntry = entry;
81        }
82      });
83    }, {
84      threshold: 0.05  // Adjust as needed
85    });
86
87    // Observe all elements
88    elements.each(function() {
89      observer.observe(this);
90    });
91  }
92
93  /* Header Position --------------------- */
94  function headerSetup() {
95    // Resize Spacer Block
96    $('.site-header + .wp-block-spacer, .site-header + .wp-block-group.woocommerce > .wp-block-spacer:first-child').css({'height':($(".header-wrapper.position-fixed").outerHeight() + 48 + 'px')});
97
98    // Sticky Position
99    $('.entry-content .position-sticky, .woocommerce-page .wc-block-components-sidebar').css({'top':($(".header-wrapper.position-fixed").outerHeight() + 48 + 'px')});
100
101    // Check For Image Banners
102    if ($('.page-template-template-blank .site-main > .entry-content > .alignfull:first-child').hasClass('obb-hero') ||
103    $('.page-template-template-blank .site-main > .entry-content > .alignfull:first-child').hasClass('obb-slideshow') ||
104    $('.page-template-template-blank .site-main > .entry-content > .alignfull:first-child').hasClass('wp-block-cover') ||
105    $('.page-template-template-blank .site-main > .entry-content > .alignfull:first-child').hasClass('wp-block-image') ||
106    $('.site-main > .alignfull:first-child').hasClass('site-banner') ||
107    $('.site-main > .alignfull:first-child').hasClass('wp-block-cover')) {
108      $('.site-header .header-wrapper.position-fixed').addClass('is-transparent')
109    }
110    if ($('.header-wrapper').hasClass('position-fixed')) {
111      $('.header-wrapper').attr('data-position', 'position-fixed')
112    }
113    if ($('.header-wrapper').hasClass('position-absolute')) {
114      $('.header-wrapper').attr('data-position', 'position-absolute')
115    }
116    if ($(this).scrollTop() > 80) {
117      $('.is-transparent').addClass('scrolling')
118    } else {
119      $('.is-transparent').removeClass('scrolling')
120    }
121    if ($('.site-logo-alt')[0]) {
122      $('.site-logo-wrapper').addClass('logo-alt-exists')
123    }
124  }
125
126  /* Mobile Submenu Dropdowns --------------------- */
127  function subMenuSetup() {
128    $('.wp-block-navigation__responsive-container-open').click(function() {
129      $(".wp-block-navigation__responsive-container .wp-block-navigation__container .wp-block-navigation-submenu").append("<span class='dropdown-arrow'><i class='fas fa-chevron-down'></i></span>");
130      
131      var subMenuToggle = $('.wp-block-navigation__container .wp-block-navigation-submenu > .dropdown-arrow').unbind();
132      subMenuToggle.on('click touchstart', function(e) {
133          e.preventDefault();
134          
135          var submenu = $(this).parent().children('.wp-block-navigation__submenu-container');
136          if ($(submenu).is(':hidden')) {
137              $(submenu).slideDown(200);
138          } else {
139              $(submenu).slideUp(200);
140          }
141      })
142    })
143    $('.wp-block-navigation__responsive-container-close').click(function() {
144        $(".wp-block-navigation__responsive-container .wp-block-navigation__container .wp-block-navigation-submenu .dropdown-arrow").remove();
145    })
146  }
147
148  $(document)
149    .ready(generalFunctions)
150    .ready(animateScroll)
151
152  $(window)
153    .on('load', subMenuSetup)
154    .on('load', headerSetup)
155    .on('scroll', headerSetup)
156    .on('resize', headerSetup)
157})(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.