PageSourceSearch

https://parkerlandscapedesign.com/wp-content/themes/parker-genesis-beaver/js/theme.js

js parkerlandscapedesign.com collected 2026-10-10 01:30:15 UTC 9,993 bytes, 327 lines download raw bytes

1jQuery(function($) {
2
3    // Back to top
4    var back_to_top = 400;
5
6    $(document).scroll(function() {
7        if ( $(this).scrollTop() > back_to_top) {
8            $('#back-to-top').addClass('show');
9        } else {
10            $('#back-to-top').removeClass('show');
11        }
12    });
13
14    $('#back-to-top').click(function(event) {
15        event.preventDefault();
16        $('html, body').animate({
17            scrollTop: 0
18        }, 500);
19        return false;
20    });
21
22    // sticky header
23    $(window).scroll(function () {
24        if ($(document).scrollTop() > 1 ) {
25            $('.site-header').addClass('sticky');
26        } else {
27            $('.site-header').removeClass('sticky');
28        }
29    });
30
31    // new tab
32    $(document).ready(function(){
33        // if link redirects to a pdf file
34        $('a[href$=".pdf"]').attr('target', '_blank');
35
36        //if href is not equal to site url add target="_blank"
37        $('a[href^="http"]').filter(function () {
38            return this.hostname && this.hostname !== location.hostname;
39        }).each(function () {
40            $(this).attr({
41                target: "_blank",
42            });
43        });
44    });
45
46
47    // footer
48    var footer_wrap = $('#genesis-footer-widgets > .wrap').height();
49    $(window).on("resize load", function () {
50        //$('#genesis-footer-widgets').height(footer_wrap);
51    });
52	
53	// Modal Before & After
54		var $trigger = $('#trigger-601c161830acb');
55		var $modal = $('#modal-601c161830acb');
56		var $modal_close = $('#modal-601c161830acb .pp-modal-close');
57
58		$trigger.click(function () {
59			$modal.addClass('show');
60
61			setTimeout(function () {
62				$modal.find('.cd-handle').each(function () {
63					var fn = $(this).data('dragDestroy');
64					if (typeof fn === 'function') fn();
65				});
66				$modal.find('.img-comparison-container').removeData('initialized');
67				initImageComparisons($modal[0]);
68			}, 50);
69		});
70
71		$modal_close.click(function () {
72
73			// Force stop any active drag
74			$('.cd-handle').removeClass('draggable');
75			$('.cd-resize-img').removeClass('resizable');
76
77			// Destroy all active drag instances
78			$('.cd-handle').each(function () {
79				var fn = $(this).data('dragDestroy');
80				if (typeof fn === 'function') {
81					fn();
82				}
83			});
84
85			// Remove initialization state
86			$modal.find('.img-comparison-container').removeData('initialized');
87
88			$modal.removeClass('show');
89		});
90	
91			$modal.addClass('show');
92	
93	// Safari touch reset
94document.body.style.webkitUserSelect = 'none';
95
96setTimeout(function () {
97    document.body.style.webkitUserSelect = '';
98}, 10);
99
100		$(document).ready(function () {
101
102			$('.img-cc.next').on('click', function (e) {
103				e.preventDefault();
104				if (!$('.img-comparison-container .cd-image-container').last().hasClass('active')) {
105					$('.cd-image-container.active').removeClass('active').next().addClass('active');
106				}
107			});
108
109			$('.img-cc.prev').on('click', function (e) {
110				e.preventDefault();
111				if (!$('.img-comparison-container .cd-image-container').first().hasClass('active')) {
112					$('.cd-image-container.active').removeClass('active').prev().addClass('active');
113				}
114			});
115
116			var scrolling = false,
117				resizing = false;
118
119			var $containers = $('.cd-image-container');
120
121			checkPosition($containers);
122
123			$(window).on('scroll', function () {
124				if (!scrolling) {
125					scrolling = true;
126					requestAnimationFrame(function () { checkPosition($containers); });
127				}
128			});
129
130			$(window).on('resize', function () {
131				if (!resizing) {
132					resizing = true;
133					requestAnimationFrame(function () { checkLabel($containers); });
134				}
135			});
136
137			function initImageComparisons(scope) {
138				$(scope).find('.img-comparison-container').each(function () {
139
140					var $container = $(this);
141					if ($container.data('initialized')) return;
142					$container.data('initialized', true);
143
144					$container.find('.cd-image-container').each(function () {
145						var $item = $(this);
146
147						var $handle = $item.find('.cd-handle');
148						var prevDestroy = $handle.data('dragDestroy');
149						if (typeof prevDestroy === 'function') prevDestroy();
150						$handle.removeData('dragDestroy');
151
152						drags(
153							$handle,
154							$item.find('.cd-resize-img'),
155							$item,
156							$item.find('.cd-image-label[data-type="original"]'),
157							$item.find('.cd-image-label[data-type="modified"]')
158						);
159					});
160				});
161			}
162
163			initImageComparisons(document);
164
165			function drags($handle, $resize, $container, $labelOriginal, $labelModified) {
166
167				var draggingActive = false;
168				var ns = '.icd_' + Date.now() + '_' + Math.random().toString(36).slice(2, 7);
169
170				$handle.off(ns).on('mousedown' + ns + ' touchstart' + ns, function (e) {
171
172					e.preventDefault();
173
174					$handle.addClass('draggable');
175					$resize.addClass('resizable');
176
177					var dragWidth       = $handle.outerWidth(),
178						containerOffset = $container.offset().left,
179						containerWidth  = $container.outerWidth(),
180						minLeft         = containerOffset + 10,
181						maxLeft         = containerOffset + containerWidth - dragWidth - 10;
182
183					var startLeft = $handle.position().left;
184					var xPosition = startLeft - (getPageX(e) - containerOffset);
185
186					draggingActive = true;
187
188					function onMove(e) {
189						if (!draggingActive) return;
190						requestAnimationFrame(function () {
191							if (!draggingActive) return;
192							animateDraggedHandle(
193								e, xPosition, dragWidth, minLeft, maxLeft,
194								containerOffset, containerWidth, $resize, $labelOriginal, $labelModified
195							);
196						});
197					}
198
199					function endDrag() {
200						if (!draggingActive) return;
201						draggingActive = false;
202						$handle.removeClass('draggable');
203						$resize.removeClass('resizable');
204						$(document).off(ns + '_move ' + ns + '_end');
205						$(window).off(ns + '_win');
206					}
207
208					$(document)
209						.off(ns + '_move ' + ns + '_end')
210						.on('mousemove' + ns + '_move touchmove' + ns + '_move', onMove)
211						.on('mouseup' + ns + '_end touchend' + ns + '_end touchcancel' + ns + '_end', endDrag);
212
213					$(window)
214						.off(ns + '_win')
215						.on('blur' + ns + '_win pagehide' + ns + '_win visibilitychange' + ns + '_win', endDrag);
216				});
217
218				$handle.data('dragDestroy', function () {
219					draggingActive = false;
220					$handle.off(ns);
221					$(document).off(ns + '_move ' + ns + '_end');
222					$(window).off(ns + '_win');
223				});
224			}
225
226			function getPageX(e) {
227				return e.pageX !== undefined ? e.pageX : e.originalEvent.touches[0].pageX;
228			}
229
230			function checkPosition(container) {
231				container.each(function () {
232					var $el = $(this);
233					if ($(window).scrollTop() + $(window).height() * 0.5 > $el.offset().top) {
234						$el.addClass('is-visible');
235					}
236				});
237				scrolling = false;
238			}
239
240			function checkLabel(container) {
241				container.each(function () {
242					var $el = $(this);
243					updateLabel($el.find('.cd-image-label[data-type="modified"]'), $el.find('.cd-resize-img'), 'left');
244					updateLabel($el.find('.cd-image-label[data-type="original"]'), $el.find('.cd-resize-img'), 'right');
245				});
246				resizing = false;
247			}
248
249			function animateDraggedHandle(e, xPosition, dragWidth, minLeft, maxLeft, containerOffset, containerWidth, resizeElement, labelOriginal, labelModified) {
250				var pageX = getPageX(e);
251				var leftValue = pageX + xPosition - dragWidth;
252				if (leftValue < minLeft) leftValue = minLeft;
253				else if (leftValue > maxLeft) leftValue = maxLeft;
254				var widthValue = ((leftValue + dragWidth / 2 - containerOffset) * 100 / containerWidth) + '%';
255				$('.draggable').css('left', widthValue);
256				$('.resizable').css('width', widthValue);
257				updateLabel(labelModified, resizeElement, 'left');
258				updateLabel(labelOriginal, resizeElement, 'right');
259			}
260
261			function updateLabel(label, resizeElement, position) {
262				if (position === 'left') {
263					(label.offset().left + label.outerWidth() < resizeElement.offset().left + resizeElement.outerWidth())
264						? label.removeClass('is-hidden')
265						: label.addClass('is-hidden');
266				} else {
267					(label.offset().left > resizeElement.offset().left + resizeElement.outerWidth())
268						? label.removeClass('is-hidden')
269						: label.addClass('is-hidden');
270				}
271			}
272
273			$(window).on('load', function () {
274				setTimeout(function () {
275					$('.cd-handle').each(function () {
276						var fn = $(this).data('dragDestroy');
277						if (typeof fn === 'function') fn();
278					});
279					$('.img-comparison-container').removeData('initialized');
280					initImageComparisons(document);
281				}, 400);
282			});
283
284		});
285
286    // Gallery Slick Slider
287        function gallery_Slick_Slider(){
288            $('.images-slick-slider .pp-photo-gallery').not('.slick-initialized').slick({
289                slidesToShow: 3,
290                slidesToScroll: 3,
291                infinite: true,
292                arrows: true,
293                autoplay: false,
294                autoplaySpeed: 5000,
295                responsive: [
296                    {
297                        breakpoint: 801,
298                        settings: {
299                            slidesToShow: 2,
300                            slidesToScroll: 2,
301                        }
302                    },
303                    {
304                        breakpoint: 481,
305                        settings: {
306                            slidesToShow: 1,
307                            slidesToScroll: 1,
308                        }
309                    },
310                ]
311            });
312        }
313
314        $(document).ready(gallery_Slick_Slider);
315        $(window).on('resize orientationchange', gallery_Slick_Slider);
316
317    // page that contains CTA with bg image sec
318        function page_has_CTA_with_bg_image() {
319            if ($('.fl-row').hasClass('cta-with-bg-sec')) {
320                $('.site-inner').css('margin-bottom','-220px');
321
322                $('.cta-with-bg-sec > .fl-row-content-wrap').css('padding-bottom','270px');
323            }
324        }
325        $(document).ready(page_has_CTA_with_bg_image);
326        $(window).on('resize orientationchange', page_has_CTA_with_bg_image);
327});

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.