PageSourceSearch

https://www.vivid-voices.com/new/wp-content/themes/lush/js/jquery.parallax.js

js vivid-voices.com collected 2026-10-03 00:33:32 UTC 1,885 bytes, 68 lines download raw bytes

1/*
2Plugin: jQuery Parallax
3Version 1.1.3 - MODIFIED BY MOTION IN DESIGN
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
14(function( $ ){
15	var $window = $(window);
16	var $pusher = $('#pusher');
17	var windowHeight = $pusher.height();
18
19	$window.resize(function () {
20		windowHeight = $pusher.height();
21	});
22
23	$.fn.parallax = function(xpos, speedFactor, outerHeight) {
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		    var firstTopCalc = $this.offset().top;
32		    var firstTopPusher = $pusher.scrollTop();
33		    firstTop = firstTopPusher + firstTopCalc;
34		});
35
36		if (outerHeight) {
37			getHeight = function(jqo) {
38				return jqo.outerHeight(true);
39			};
40		} else {
41			getHeight = function(jqo) {
42				return jqo.height();
43			};
44		}
45
46		// setup defaults if arguments aren't specified
47		if (arguments.length < 1 || xpos === null) xpos = "50%";
48		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
49		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
50
51		// function to be called whenever the window is scrolled or resized
52		function update(){
53			var pos = $pusher.scrollTop();
54
55			$this.each(function(){
56				var $element = $(this);
57				var top = $element.offset().top;
58				var height = getHeight($element);
59				// debugger
60				$this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px");
61			});
62		}
63
64		$pusher.on('scroll', update );
65		$(window).on('resize', update );
66		update();
67	};
68})(jQuery);

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.