PageSourceSearch

https://www.node.coop/wp-content/themes/understrap-child/assets/js/modules/utils.js?v=718

js node.coop collected 2026-09-24 10:38:42 UTC 3,081 bytes, 107 lines download raw bytes

1jQuery(function($){
2    'use strict';
3
4    /** Utils */
5    ND.utils = function(){
6
7        ND.utils.cardTitles();
8        ND.utils.Bullet();
9        ND.utils.NextSectionCta();
10        ND.utils.backToTop();
11    };
12
13    ND.utils.cardTitles = function(){
14        
15    }    
16
17    ND.utils.Bullet = function(){
18
19        function updateBeforePosition() {
20
21            const container = document.querySelector("section > .container");
22
23            const wW = window.outerWidth;
24        
25            let additionalOffset = -8;
26        
27            if (  wW < 576 ) {
28        
29                additionalOffset = 16;
30        
31            }
32        
33            if (container) {
34
35                const containerRect = container.getBoundingClientRect();
36                const body = document.body;
37        
38                // Calcola la posizione del lato sinistro del container
39                const leftOffset = containerRect.left + additionalOffset;
40        
41                // Aggiorna la variabile CSS per il `::before`
42                body.style.setProperty("--before-left", `${leftOffset}px`);
43                
44                setTimeout(function(){
45                    if (!body.classList.contains("w-bullet-animated")) {
46                        body.classList.add("w-bullet-animated");
47                    }
48                }, 1000);
49            }
50        }
51        
52        $(document).ready(function(){ updateBeforePosition();});
53
54        $(window).on('resize', function(){ updateBeforePosition(); })
55        $(window).on('load', function() { 
56
57            setTimeout(function() {
58                updateBeforePosition();
59            }, 300);
60        });
61
62    };
63
64    ND.utils.NextSectionCta = function () {
65        $(".next-section-cta").on("click", function (e) {
66            e.preventDefault();
67            // Trova la section successiva rispetto alla section che contiene il .cta
68            var nextSection = $(this).closest("section").next("section");
69            
70            if (nextSection.length) {
71                // Scrolla alla section successiva con animazione
72                setTimeout(function(){
73                    $("html, body").animate(
74                        { scrollTop: (nextSection.offset().top) - 30 },
75                        100, // Durata dell'animazione in millisecondi
76                        
77                    );
78
79                },500);
80                
81            }
82        });
83    }
84
85    ND.utils.backToTop = function () {
86        // Funzione per tornare in cima
87        function scrollToTop() {
88            $('html, body').scrollTop(0); 
89        }
90
91        // Mostra o nasconde il pulsante al cambiamento dello scroll
92        $(window).on('scroll', function() {
93            if ($(this).scrollTop() > 300) {
94                $('.back-to-top').fadeIn(200);
95            } else {
96                $('.back-to-top').fadeOut(200);
97            }
98        });
99
100        // Aggiungi l'evento di click per tornare al top
101        $('.back-to-top').on('click', function(e) {
102            e.preventDefault();
103            scrollToTop();
104        });
105
106    }
107});

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.