PageSourceSearch

https://kantang.ac.th/components/com_pagebuilderck/assets/parallaxbackground.js?ver=3.6.1

js kantang.ac.th collected 2026-10-02 00:41:00 UTC 1,934 bytes, 65 lines download raw bytes

1/**
2 * @name		Parallax Background Widget for Page Builder CK
3 * @copyright	Copyright (C) 2019. 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 PBCK_ParallaxBackground = function(container, options) {
10		var defaults = {
11			speed: '50'			// 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 PBCK_ParallaxBackground(el.find('> .inner'), opts);
25				return;
26			}
27			if (el.attr('data-parallax')) opts.speed = el.attr('data-parallax');
28
29			el.css({
30				'background-position': 'center 0px',
31				'background-size': 'cover',
32				'background-attachment': 'fixed'
33			});
34
35			moveElement(el);
36			$window.bind('scroll load', function() { moveElement(el); });
37			$window.bind('resize', function() { moveElement(el); });
38		});
39
40		function moveElement(el) {
41			var winY = $window.scrollTop();
42			el.top = el.offset().top;
43			el.height = el.outerHeight();
44
45			// check if totally above or totally below viewport
46			if (
47				el.top + el.height < winY // bottom of element is over top of screen
48				|| el.top > winY + $window.height() // top of element is under bottom of screen
49				) {
50				return;
51			}
52
53			var bgy = (- Math.round( ((winY - el.top ) ) )) - (winY * opts.speed / 100);
54
55			// move the background image
56			el.css('background-position', "center " + bgy/10 + "px");
57		}
58	};
59	window.PBCK_ParallaxBackground = PBCK_ParallaxBackground;
60})(jQuery);
61
62// init the effect on rows that have the parallax attribute
63jQuery(document).ready(function(){ 
64	new PBCK_ParallaxBackground('.rowck[data-parallax]');
65});

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.