PageSourceSearch

https://renardsdumanet.fr/templates/templatelrm001/js/parallaxbackground.js

js renardsdumanet.fr collected 2026-10-04 03:13:46 UTC 1,699 bytes, 58 lines download raw bytes

1/**
2 * @name		Parallax Background Widget for Template Creator CK
3 * @copyright	Copyright (C) 2016. All rights reserved.
4 * @license		GNU General Public License version 2 or later; see LICENSE.txt
5 * @author		Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr
6 */
7
8(function($) {
9	var TCK_ParallaxBackground = function(container, options) {
10		var defaults = {
11			speed: '5'			// speed factor
12		};
13
14		if (container == '#body') container = document.body;
15		var opts = $.extend(defaults, options);
16		var els = $(container);
17		var $window = $(window);
18
19		els.each(function() {
20			var el = $(this);
21			var bgimage = el.css('background-image');
22
23			if (bgimage == 'none' && el.find('> .inner').length) {
24				new TCK_ParallaxBackground(el.find('> .inner'), opts);
25				return;
26			}
27
28			el.css({
29				'background-position': 'center 0px',
30				'background-size': 'cover',
31				'background-attachment': 'fixed'
32			});
33
34			moveElement(el);
35			$window.bind('scroll load', function() { moveElement(el); });
36			$window.bind('resize', function() { moveElement(el); });
37		});
38
39		function moveElement(el) {
40			var winY = $window.scrollTop();
41			el.top = el.offset().top;
42			el.height = el.outerHeight();
43
44			// check if totally above or totally below viewport
45			if (
46				el.top + el.height < winY // bottom of element is over top of screen
47				|| el.top > winY + $window.height() // top of element is under bottom of screen
48				) {
49				return;
50			}
51
52			var bgy = - Math.round( ((winY - el.top ) ) ) - winY * opts.speed / 100;
53			// move the background image
54			el.css('background-position', "center " + bgy/10 + "px");
55		}
56	};
57	window.TCK_ParallaxBackground = TCK_ParallaxBackground;
58})(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.