PageSourceSearch

https://randysuttonspeaks.com/sites/all/themes/athlete/js/parallax/jquery.parallax-1.1.3.js?sco4vy

js randysuttonspeaks.com collected 2026-10-10 00:59:14 UTC 1,913 bytes, 71 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
14(function( $ ){
15	"use strict";
16	var $window = $(window);
17	var windowHeight = $window.height();
18
19	$window.resize(function () {
20		windowHeight = $window.height();
21	});
22
23	$.fn.btparallaxfix = 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		    firstTop = $this.offset().top;
32		});
33
34		if (outerHeight) {
35			getHeight = function(jqo) {
36				return jqo.outerHeight(true);
37			};
38		} else {
39			getHeight = function(jqo) {
40				return jqo.height();
41			};
42		}
43			
44		// setup defaults if arguments aren't specified
45		if (arguments.length < 1 || xpos === null) xpos = "50%";
46		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
47		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
48		
49		// function to be called whenever the window is scrolled or resized
50		function update(){
51			var pos = $window.scrollTop();				
52
53			$this.each(function(){
54				if($(this).is(":hidden")) return;
55				var $element = $(this);
56				/*var top = $element.offset().top;*/
57				var height = getHeight($element);
58
59				// Check if totally above or totally below viewport
60				if (top + height < pos || top > pos + windowHeight) {
61					return;
62				}
63
64				$this.find('.parallax-background').css(/*'top',*/ Math.round(-1 * (firstTop - pos) * speedFactor) + "px");
65			});
66		}		
67
68		$window.bind('scroll', update).resize(update);
69		update();
70	};
71})(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.