PageSourceSearch

https://barricaid.com/wp-content/themes/barricaid/js/custom.js?ver=a3cb37c298a676efd996bb99e829632a

js barricaid.com collected 2026-09-28 10:33:15 UTC 5,118 bytes, 133 lines download raw bytes

1// jQuery is used in no-conflict mode in WordPress. Therefore, we should not use the $ in the global scope as well.
2
3jQuery(window).load(function(){
4    scrollspy_adjuster();
5});
6
7jQuery(window).resize(function(){
8    scrollspy_adjuster();
9});
10
11jQuery(window).scroll(function() {
12    $ = jQuery;
13    var scroll = $(window).scrollTop();
14
15    if (scroll >= 100) {
16        $(".header-wrapper").addClass('scrolled');
17        $(".scrollspy").parent().addClass('scrolled-spy');
18    } else {
19        $(".header-wrapper").removeClass('scrolled');
20        $(".scrollspy").parent().removeClass('scrolled-spy');
21    }
22
23    highlight_scrollspy_item();
24
25    footer_form_animation();
26});
27
28jQuery("#down-arrow").click(function(event) {
29    event.preventDefault();
30    var sectionTop = $('.entry-content').offset().top;
31    jQuery('html,body').animate({
32        scrollTop: sectionTop },
33        'slow');
34 });
35
36 jQuery(document).on('click', 'a[href^="#"]', function (event) {
37    $ = jQuery;
38    event.preventDefault();
39
40    if($(window).innerWidth() > 1199){
41        if($('.entry-header').hasClass('scrolled-spy')){
42            var $from_top = $($.attr(this, 'href')).offset().top - $('#masthead').height() - $('.scrolled-spy').height() + 50;
43        }else{
44            var $from_top = $($.attr(this, 'href')).offset().top - $('#masthead').height() - $('.entry-header .entry-title').outerHeight(true) - $('.scrollspy').outerHeight(true) - 150;
45        }
46    }else{
47        if($('.entry-header').hasClass('scrolled-spy')){
48            var $from_top = $($.attr(this, 'href')).offset().top - $('#masthead').height() - $('.scrolled-spy').height() + 50;
49        }else{
50            var $from_top = $($.attr(this, 'href')).offset().top - $('#masthead').height() - $('.scrolled-spy').height() - 120;
51        }
52        // var $from_top = $($.attr(this, 'href')).offset().top;
53    }
54
55    console.log($from_top);
56
57    $('html, body').animate({
58        scrollTop: $from_top
59    }, 500);
60});
61
62function footer_form_animation(){
63    $ = jQuery;
64    if($(window).innerWidth() > 768){
65        
66        var scroller_height = 40;
67        
68        $('#lead-capture').css('margin-bottom', '-' + $('#lead-capture').outerHeight() + 'px');
69        if(window.pageYOffset + jQuery(window).height() > $('#lead-capture').offset().top + scroller_height){
70            var lead_scroll = window.pageYOffset + jQuery(window).height() - $('#lead-capture').offset().top;
71            lead_scroll -= scroller_height;
72            if($('#lead-capture').outerHeight() > lead_scroll){
73                $('#lead-capture').css('margin-top', lead_scroll);
74                $('#lead-capture').css('bottom', lead_scroll);
75            }else{
76                $('#lead-capture').css('margin-top', $('#lead-capture').outerHeight());
77                $('#lead-capture').css('bottom', $('#lead-capture').outerHeight());
78            }
79        }
80    }else{
81        $('#lead-capture').removeAttr('style');
82    }
83}
84
85function scrollspy_adjuster(){
86    var $ul_width = 0;
87    $ = jQuery;
88    $('.scrollspy__menu-item:last-child').css('margin-right', $('.scrollspy').width() - $('.scrollspy__menu-item:last-child').width() + 'px');
89    $( ".scrollspy__menu-item" ).each(function( index ) {
90        $( this ).find('.scrollspy__menu-item-link').attr('data-scroll', $ul_width);
91        $ul_width += $( this ).outerWidth(true) + 3;
92    });
93    if($(window).innerWidth() < 768){
94        $('.scrollspy__menu').width($ul_width);
95    }else{
96        $('.scrollspy__menu').removeAttr('style');
97        $('.scrollspy__menu-item:last-child').removeAttr('style');
98    }
99}
100
101function highlight_scrollspy_item(){
102    $('.scrollspy-menu-anchor').each(function() {
103        var $scrollspy_item_top = $(this).offset().top - $('#masthead').height() - $('.scrolled-spy').height() + 45;
104        var $first_scrollspy_item_top = $('.scrollspy-menu-anchor:nth-of-type(1)').offset().top - $('#masthead').height() - $('.scrolled-spy').height() + 45;
105
106        if($(window).scrollTop() >= $scrollspy_item_top) {
107            var id = $(this).attr('id');
108            if(!$('.scrollspy__menu a[href=#'+ id +']').hasClass('active')){
109                $('.scrollspy__menu a').removeClass('active');
110                $('.scrollspy__menu a[href=#'+ id +']').addClass('active');
111                if($('.scrollspy__menu-item-link').hasClass('active')){
112                    // $('.scrollspy').scrollLeft($('.scrollspy__menu-item-link.active').offset().left - 30);
113                    $('.scrollspy').scrollLeft($('.scrollspy__menu-item-link.active').attr('data-scroll'));
114                }
115            }
116        }
117
118        if($(window).scrollTop() < $first_scrollspy_item_top) {
119            $('.scrollspy__menu a').removeClass('active');
120        }
121    });
122}
123
124/**
125 * Call Tag Manager code
126 */
127jQuery(document).ready(function($){
128    var observer = new MutationObserver(function(){
129        __ctm.main.runNow();
130    });
131
132    observer.observe(document.querySelector('#wpsl-stores ul'), {childList: true});
133});

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.