PageSourceSearch

https://www.protectedcultivation.com/assets/web/js/main.js

js protectedcultivation.com collected 2026-10-03 00:35:55 UTC 7,841 bytes, 251 lines download raw bytes

1// sidebar script
2function openNav() {
3    document.getElementById("mySidenav").style.transform = "translateX(0)";
4    document.getElementById("mySidenav").style.visibility = "visible";
5    document.getElementById("main").style.marginLeft = "250px";
6    document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
7}
8
9function closeNav() {
10    document.getElementById("mySidenav").style.transform = "translateX(100%)";
11    document.getElementById("mySidenav").style.visibility = "hidden";
12    document.getElementById("main").style.marginLeft = "0";
13    document.body.style.backgroundColor = "white";
14}
15
16$(document).ready(function () {
17    $('.menu-toggle').click(function () {
18        $('nav').toggleClass('active')
19    })
20    $('ul li').click(function () {
21        $(this).siblings().removeClass('active');
22        $(this).toggleClass('active');
23    })
24})
25
26
27
28var win_width = $(window).width();
29var url = window.location.href;
30var res = url.split("/");
31var set = res[4];
32var set2 = res[3];
33if (win_width >= 700) {
34    if (set != 'product_detail') {
35        window.onscroll = function () { myFunction() };
36        var header = document.getElementById("myHeader");
37        var win_height = $(window).height();
38        var sticky = header.offsetTop;
39
40        function myFunction() {
41            if (window.pageYOffset > sticky) {
42                header.classList.add("sticky");
43                $("#myHeader .header-logo a").addClass("site-logo-1");
44                $("#addColor a").css("color","#5a5a5a");
45                $("#changeBackground .header-menu-icon").css("backgroundColor","#5a5a5a");
46            } else {
47                header.classList.remove("sticky");
48                $('#myHeader .header-logo a').removeClass("site-logo-1");
49                $('#addColor a').removeAttr("style");
50                $('#changeBackground .header-menu-icon').removeAttr("style");
51
52            }
53        }
54
55    } else {
56
57        window.onload = function () { myFunction2() };
58
59        var header = document.getElementById("myHeader");
60        var win_height = $(window).height();
61        var sticky = header.offsetTop;
62
63        function myFunction2() {
64            header.classList.add("sticky");
65            $("#myHeader .header-logo a").addClass("site-logo-1");
66            $("#addColor a").css("color","#5a5a5a");
67            $("#changeBackground .header-menu-icon").css("backgroundColor","#5a5a5a");
68
69        }
70    }
71} else {
72    window.onload = function () { myFunction3() };
73
74    var header = document.getElementById("myHeader");
75    var win_height = $(window).height();
76    var sticky = header.offsetTop;
77
78    function myFunction3() {
79        header.classList.add("sticky");
80        $("#myHeader .header-logo a").addClass("site-logo-1");
81        $("#addColor a").css("color","#5a5a5a");
82        $("#changeBackground .header-menu-icon").css("backgroundColor","#5a5a5a");
83
84    }
85}
86
87
88// $("#home").css('height', win_height);
89var win_width = $(window).width();
90var url = window.location.href;
91var res = url.split("/");
92var set = res[4];
93var set2 = res[3];
94if (win_width >= 700) {
95    if (set != 'product_detail') {
96        window.onscroll = function () { myFunction() };
97        var header = document.getElementById("myHeader");
98        var win_height = $(window).height();
99        var sticky = header.offsetTop;
100
101        function myFunction() {
102            if (window.pageYOffset > sticky) {
103                header.classList.add("sticky");
104                $("#myHeader .header-logo a").addClass("site-logo-1");
105                $("#addColor a").css("color","#5a5a5a");
106                $("#changeBackground .header-menu-icon").css("backgroundColor","#5a5a5a");
107            } else {
108                header.classList.remove("sticky");
109                $('#myHeader .header-logo a').removeClass("site-logo-1");
110                $('#addColor a').removeAttr("style");
111                $('#changeBackground .header-menu-icon').removeAttr("style");
112
113            }
114        }
115    } else {
116
117        window.onload = function () { myFunction2() };
118
119        var header = document.getElementById("myHeader");
120        var win_height = $(window).height();
121        var sticky = header.offsetTop;
122
123        function myFunction2() {
124            header.classList.add("sticky");
125            $("#myHeader .header-logo a").addClass("site-logo-1");
126            $("#addColor a").css("color","#5a5a5a");
127            $("#changeBackground .header-menu-icon").css("backgroundColor","#5a5a5a");
128
129        }
130    }
131} else {
132    window.onload = function () { myFunction3() };
133
134    var header = document.getElementById("myHeader");
135    var win_height = $(window).height();
136    var sticky = header.offsetTop;
137
138    function myFunction3() {
139        header.classList.add("sticky");
140        $("#myHeader .header-logo a").addClass("site-logo-1");
141        $("#addColor a").css("color","#5a5a5a");
142        $("#changeBackground .header-menu-icon").css("backgroundColor","#5a5a5a");
143
144    }
145}
146
147
148$(document).ready(function () {
149    $(document).on("scroll", onScroll);
150
151    $('#sidebar a[href^="#"]').on('click', function (e) {
152        e.preventDefault();
153        $(document).off("scroll");
154
155        $('a').each(function () {
156            $(this).removeClass('sidemenu-active');
157        })
158        $(this).addClass('sidemenu-active');
159
160        var target = this.hash;
161        $target = $(target);
162        $('html, body').stop().animate({
163            'scrollTop': $target.offset().top+2
164        }, 50, 'swing', function () {
165            window.location.hash = target;
166            $(document).on("scroll", onScroll);
167        });
168    });
169});
170
171function onScroll(event){
172    var scrollPosition = $(document).scrollTop();
173    $('#sidebar a').each(function () {
174        var currentLink = $(this);
175        var refElement = $(currentLink.attr("href"));
176        if (refElement.position().top <= scrollPosition && refElement.position().top + refElement.height() > scrollPosition) {
177            $('#sidebar ul li a').removeClass("sidemenu-active");
178            currentLink.addClass("sidemenu-active");
179        }
180        else{
181            currentLink.removeClass("sidemenu-active");
182        }
183    });
184}
185
186
187
188$(document).ready(function () {
189    $("a[href*='#enquery']").on('click', function (event) {
190        if (this.hash !== "") {
191            event.preventDefault();
192            var hash = this.hash;
193            $('html, body').animate({
194                scrollTop: $(hash).offset().top - 260
195            }, 800, function () { });
196        }
197    });
198});
199
200$(document).ready(function () {
201    $("a[href*='#about']").on('click', function (event) {
202        if (this.hash !== "") {
203            event.preventDefault();
204            var hash = this.hash;
205            $('html, body').animate({
206                scrollTop: $(hash).offset().top - 50
207            }, 800, function () { });
208        }
209    });
210});
211
212$(document).ready(function () {
213    $("a[href*='#whyUs']").on('click', function () {
214        if (this.hash !== "") {
215            // event.preventDefault();
216            var hash = this.hash;
217            $('html, body').animate({
218                scrollTop: $(hash).offset().top - 90
219            }, 800, function () { });
220        }
221    });
222});
223
224
225
226
227
228
229
230function banner() {
231    var win_height = $(window).height();
232    $("#home").css('height', win_height);
233}
234
235
236// var num = 0; //number of pixels before modifying styles
237// var item_list = $('#item_list').height();
238
239// $(window).bind('scroll', function () {
240//     if ($(window).scrollTop()) {
241//         $('#sidebar').addClass('side-menu-fixed');
242//         $("#sidebar").addClass("side-menu-fixed");
243//         if (window.pageYOffset >= item_list) {
244//             $('#sidebar').removeClass('side-menu-fixed');
245//             $('#sidebar').removeClass("side-menu-fixed");
246//         }
247//     } else {
248//         $('#sidebar').removeClass('side-menu-fixed');
249
250//     }
251// });

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.