PageSourceSearch

https://www.teakwoodbuilders.com/wp-content/themes/teakwood/js/scripts.js

js teakwoodbuilders.com collected 2026-10-04 12:35:34 UTC 2,869 bytes, 91 lines download raw bytes

1$(function () {
2    // Mobile Nav
3    $("#mnavbutton").on("click", function () {
4        var el = $(this);
5        var nav = $("header nav");
6        var header = $("header");
7        if (el.is(".active")) {
8            nav.attr("aria-expanded", false);
9        } else {
10            nav.attr("aria-expanded", true);
11        }
12        header.toggleClass("active");
13        nav.toggleClass("active");
14        el.toggleClass("active");
15    });
16
17    // Smooth Anchor Scrolling
18    jQuery(document).ready(function ($) {
19        $('a[href^="#"]').on("click", function (e) {
20            const target = $(this.getAttribute("href"));
21
22            if (target.length) {
23                e.preventDefault();
24
25                const scrollTop = $(window).scrollTop();
26                const targetTop = target.offset().top;
27                const distance = Math.abs(targetTop - scrollTop);
28
29                const speed = 2.8; // pixels per ms (adjust for faster/slower)
30                const duration = distance / speed;
31
32                $("html, body").animate(
33                    {
34                        scrollTop: targetTop - 150,
35                    },
36                    duration
37                );
38            }
39        });
40    });
41
42    // Scrolled Hide
43    $(window).on("scroll", function () {
44        if ($(this).scrollTop() > 100) {
45            $(".scroll").addClass("scrolled");
46        } else {
47            $(".scroll").removeClass("scrolled");
48        }
49    });
50
51    // FitVits Responsive Embeds
52    $(".wp-block-embed-youtube .wp-block-embed__wrapper").fitVids();
53});
54
55const lazyBackgroundsGeneral = document.querySelectorAll(".other-lazy");
56if ("IntersectionObserver" in window) {
57    const observer = new IntersectionObserver(
58        (entries, obs) => {
59            entries.forEach((entry) => {
60                if (entry.isIntersecting) {
61                    const el = entry.target;
62                    const bgUrl = el.getAttribute("data-bg");
63
64                    if (bgUrl) {
65                        const img = new Image();
66                        img.src = bgUrl;
67
68                        img.onload = () => {
69                            const photoHolder = el.querySelector(".img_holder");
70
71                            if (photoHolder) {
72                                photoHolder.style.backgroundImage = `url('${bgUrl}')`;
73                            } else {
74                                console.warn("No .img_holder:", el);
75                            }
76
77                            el.classList.add("other_loaded");
78                            obs.unobserve(el);
79                        };
80                    }
81                }
82            });
83        },
84        {
85            root: null,
86            rootMargin: "0px 0px 200px 0px",
87            threshold: 0.01,
88        }
89    );
90    lazyBackgroundsGeneral.forEach((el) => observer.observe(el));
91}

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.