PageSourceSearch

https://masseriafrancescani.com/wp-content/themes/hello-theme-child-extralberghiero/js/main.js?ver=1.0.0

js masseriafrancescani.com collected 2026-10-05 23:17:30 UTC 2,395 bytes, 83 lines download raw bytes

1//Dynamic Background Color
2
3jQuery(window)
4  .scroll(function () {
5    var $window = jQuery(window),
6      $body = jQuery("body"),
7      $panel = jQuery(".dynamic-bg-color");
8    var scroll = $window.scrollTop() + $window.height() / 4;
9
10    // Change 33% earlier than scroll position so colour is there when you arrive.
11
12    $panel.each(function () {
13      var $this = jQuery(this);
14
15      // if position is within range of this panel.
16      // So position of (position of top of div <= scroll position) && (position of bottom of div > scroll position).
17      // Remember we set the scroll to 33% earlier in scroll var.
18      if (
19        $this.offset().top <= scroll &&
20        $this.offset().top + $this.height() > scroll
21      ) {
22        // Remove all classes on body with color-
23        $body.removeClass(function (index, css) {
24          return (css.match(/(^|\s)dbg-color-\S+/g) || []).join(" ");
25        });
26
27        // Add class of currently active div
28        $body.addClass("dbg-color-" + jQuery(this).data("dbg-color"));
29      }
30    });
31  })
32  .scroll();
33
34// 🔹 Navbar Scroll Animation: classe "scrolling" e scomparsa in fondo pagina
35
36document.addEventListener('DOMContentLoaded', function(){
37	const navbar = document.querySelector('#scrollable-navbar');
38
39	function navbarOnScroll() {
40		if (!navbar) return;
41
42		const scrollY = window.scrollY;
43		const windowHeight = window.innerHeight;
44
45		// Altezza documento più affidabile
46		const docHeight = Math.max(
47			document.body.scrollHeight,
48			document.documentElement.scrollHeight
49		);
50
51		// Breakpoint mobile con media query
52		const isMobile = window.matchMedia('(max-width: 768px)').matches;
53
54		// Offset diverso per desktop e mobile
55		const bottomOffset = isMobile ? 1600 : 500;
56
57		// Controllo fondo pagina con offset dinamico
58		const isAtBottom = scrollY + windowHeight >= docHeight - bottomOffset;
59
60		// Stato classe scrolling
61		if (scrollY > 0) {
62			navbar.classList.add('scrolling');
63		} else {
64			navbar.classList.remove('scrolling');
65		}
66		
67		// Gestione opacità
68		if (isAtBottom) {
69			navbar.style.opacity = '0';
70		} else {
71			navbar.style.opacity = '1';
72		}
73
74		// Debug utile
75		// console.log({ scrollY, windowHeight, docHeight, isMobile, bottomOffset, isAtBottom });
76	}
77	
78	if (navbar) {
79		navbarOnScroll(); 
80		window.addEventListener('scroll', navbarOnScroll);
81		window.addEventListener('resize', navbarOnScroll);
82	}
83});

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.