PageSourceSearch

https://www.hausboot-vermietung.net/js/jquery.easy-parallax.js

js hausboot-vermietung.net collected 2026-10-07 01:57:19 UTC 2,003 bytes, 62 lines download raw bytes

1/*
2 Plugin: jQuery Fake-Parallax
3 Version 0.1.1
4 Author: Maik Lampe, <[email protected]>
5 
6 Base on jQuery Parallax by Ian Lunn - http://www.ianlunn.co.uk/plugins/jquery-parallax/
7 Twitter: @IanLunn
8 
9 Dual licensed under the MIT and GPL licenses:
10 http://www.opensource.org/licenses/mit-license.php
11 http://www.gnu.org/licenses/gpl.html
12 */
13
14(function ($) {
15    var $window = $(window);
16    var windowHeight = $window.height();
17
18    $window.resize(function () {
19        windowHeight = $window.height();
20    });
21
22    $.fn.easyParallax = function (xpos, speedFactor) {
23        var $this = $(this);
24        var getHeight = function (jqo) {
25            return jqo.outerHeight(true);
26        };
27
28        /* @see https://www.arduino.cc/en/Reference/Map */
29        function arduinoMap(x, in_min, in_max, out_min, out_max) {
30            return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
31        }
32
33        // setup defaults if arguments aren't specified
34        if (arguments.length < 1 || xpos === null)
35            xpos = "50%";
36        if (arguments.length < 2 || speedFactor === null)
37            speedFactor = 1;
38
39        // function to be called whenever the window is scrolled or resized
40        function update() {
41            var pos = $window.scrollTop();
42            $this.each(function () {
43                var $element = $(this);
44                var top = $element.offset().top;
45                var height = getHeight($element);
46
47                // Check if totally above or totally below viewport
48                if (top + height < pos || top > pos + windowHeight) {
49                    return;
50                }
51
52                localPos = arduinoMap(pos, top - windowHeight, top + height, 0, 100) * speedFactor + "%";
53
54                // $element.css('backgroundPositionY', xpos + " " + localPos);
55                $element.css('backgroundPositionY', localPos);
56            });
57        }
58
59        $window.bind('scroll resize', update);
60        update();
61    };
62})(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.