PageSourceSearch

https://moda.ru/wp-content/themes/venosa/js/parallax-img.js

js moda.ru collected 2026-10-02 07:55:14 UTC 2,029 bytes, 90 lines download raw bytes

1/*
2Plugin: jQuery Parallax
3Version 1.1.3
4Author: Ian Lunn
5Twitter: @IanLunn
6Author URL: http://www.ianlunn.co.uk/
7Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/
8
9Dual licensed under the MIT and GPL licenses:
10http://www.opensource.org/licenses/mit-license.php
11http://www.gnu.org/licenses/gpl.html
12*/
13'use strict';
14(function( $ ){
15	var $window = $(window);
16	var windowHeight = $window.height();
17
18	$window.resize(function () {
19		windowHeight = $window.height();
20	});
21
22	$.fn.parallax = function(xpos, speedFactor, outerHeight) {
23
24		var $this = $(this);
25		var getHeight;
26		var firstTop;
27		var paddingTop = 0;
28
29		//get the starting position of each element to have parallax applied to it
30		$this.each(function(){
31
32		    firstTop = $this.offset().top;
33
34		});
35
36		if (outerHeight) {
37
38			getHeight = function(jqo) {
39				return jqo.outerHeight(true);
40			};
41
42		} else {
43
44			getHeight = function(jqo) {
45				return jqo.height();
46			};
47
48		}
49
50		// setup defaults if arguments aren't specified
51		if (arguments.length < 1 || xpos === null) xpos = "50%";
52		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
53		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
54
55		// function to be called whenever the window is scrolled or resized
56		function update(){
57			var pos = $window.scrollTop();
58
59			$this.each(function(){
60
61				var $element = $(this);
62				var top = $element.offset().top;
63				var height = getHeight($element);
64
65				// Check if totally above or totally below viewport
66				if ( top + height < pos || 
67					 top > pos + windowHeight ) {
68					return;
69				}
70				/*
71				 * Add scroll background behavior
72				 */
73				$this.css({'background-attachment':'scroll'});
74
75				$this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor - 200) + "px");
76			});
77		}
78
79		$window.bind('scroll', update).resize(update);
80		update();
81	};
82})(jQuery);
83
84if ( jQuery(window).width() > 768 ) {
85	jQuery('[data-parallax="y"]').each(function(){
86
87		jQuery(this).parallax("50%", -0.25);
88
89	})
90}

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.