PageSourceSearch

https://springgreen-barracuda-526349.hostingersite.com/wp-content/…/js/libs/parallax-scroll.js?ver=1.0.6

js springgreen-barracuda-526349.hostingersite.com collected 2026-10-03 04:55:57 UTC 10,909 bytes, 197 lines download raw bytes

1(function( $ ) {
2    
3    $( document ).ready( function() {
4        var ParallaxScroll = {
5            /* PUBLIC VARIABLES */
6            showLogs: false,
7            round: 1000,
8
9            /* PUBLIC FUNCTIONS */
10            init: function() {
11                this._log("init");
12                if (this._inited) {
13                    this._log("Already Inited");
14                    this._inited = true;
15                    return;
16                }
17                this._requestAnimationFrame = (function(){
18                  return  window.requestAnimationFrame       || 
19                          window.webkitRequestAnimationFrame || 
20                          window.mozRequestAnimationFrame    || 
21                          window.oRequestAnimationFrame      || 
22                          window.msRequestAnimationFrame     || 
23                          function(/* function */ callback, /* DOMElement */ element){
24                              window.setTimeout(callback, 1000 / 60);
25                          };
26                })();
27                this._onScroll(true);
28            },
29
30            /* PRIVATE VARIABLES */
31            _inited: false,
32            _properties: ['x', 'y', 'z', 'rotateX', 'rotateY', 'rotateZ', 'scaleX', 'scaleY', 'scaleZ', 'scale'],
33            _requestAnimationFrame:null,
34
35            /* PRIVATE FUNCTIONS */
36            _log: function(message) {
37                if (this.showLogs) console.log("Parallax Scroll / " + message);
38            },
39            _onScroll: function(noSmooth) {
40                var scroll = $(document).scrollTop();
41                var windowHeight = $(window).height();
42                this._log("onScroll " + scroll);
43                $("[data-parallax]").each($.proxy(function(index, el) {
44                    var $el = $(el);
45                    var properties = [];
46                    var applyProperties = false;
47                    var style = $el.data("style");
48                    if (style == undefined) {
49                        style = $el.attr("style") || "";
50                        $el.data("style", style);
51                    }
52                    var datas = [$el.data("parallax")];
53                    var iData;
54                    for(iData = 2; ; iData++) {
55                        if($el.data("parallax"+iData)) {
56                            datas.push($el.data("parallax-"+iData));
57                        }
58                        else {
59                            break;
60                        }
61                    }
62                    var datasLength = datas.length;
63                    for(iData = 0; iData < datasLength; iData ++) {
64                        var data = datas[iData];
65                        var scrollFrom = data["from-scroll"];
66                        var scrollFromCustom = data["from-scroll-custom"];
67                        if (scrollFrom == undefined){
68                            //scrollFrom = Math.max(0, $(el).offset().top - (windowHeight / 2) );
69                            if(scrollFromCustom != undefined)
70                                scrollFrom = Math.max(0, $(el).offset().top - scrollFromCustom );
71                            else
72                                scrollFrom = Math.max(0, $(el).offset().top - windowHeight );
73                        } 
74                        scrollFrom = scrollFrom | 0;
75                        var scrollDistance = data["distance"];
76                        var scrollTo = data["to-scroll"];
77                        if (scrollDistance == undefined && scrollTo == undefined) scrollDistance = windowHeight;
78                        scrollDistance = Math.max(scrollDistance | 0, 1);
79                        var easing = data["easing"];
80                        var easingReturn = data["easing-return"];
81                        if (easing == undefined || !$.easing|| !$.easing[easing]) easing = null;
82                        if (easingReturn == undefined || !$.easing|| !$.easing[easingReturn]) easingReturn = easing;
83                        if (easing) {
84                            var totalTime = data["duration"];
85                            if (totalTime == undefined) totalTime = scrollDistance;
86                            totalTime = Math.max(totalTime | 0, 1);
87                            var totalTimeReturn = data["duration-return"];
88                            if (totalTimeReturn == undefined) totalTimeReturn = totalTime;
89                            scrollDistance = 1;
90                            var currentTime = $el.data("current-time");
91                            if(currentTime == undefined) currentTime = 0;
92                        }
93                        if (scrollTo == undefined) scrollTo = scrollFrom + scrollDistance;
94                        scrollTo = scrollTo | 0;
95                        var smoothness = data["smoothness"];
96                        if (smoothness == undefined) smoothness = 30;
97                        smoothness = smoothness | 0;
98                        if (noSmooth || smoothness == 0) smoothness = 1;
99                        smoothness = smoothness | 0;
100                        var scrollCurrent = scroll;
101                        scrollCurrent = Math.max(scrollCurrent, scrollFrom);
102                        scrollCurrent = Math.min(scrollCurrent, scrollTo);
103                        if(easing) {
104                            if($el.data("sens") == undefined) $el.data("sens", "back");
105                            if(scrollCurrent>scrollFrom) {
106                                if($el.data("sens") == "back") {
107                                    currentTime = 1;
108                                    $el.data("sens", "go");
109                                }
110                                else {
111                                    currentTime++;
112                                }
113                            }
114                            if(scrollCurrent<scrollTo) {
115                                if($el.data("sens") == "go") {
116                                    currentTime = 1;
117                                    $el.data("sens", "back");
118                                }
119                                else {
120                                    currentTime++;
121                                }
122                            }
123                            if(noSmooth) currentTime = totalTime;
124                            $el.data("current-time", currentTime);
125                        }
126                        this._properties.map($.proxy(function(prop) {
127                            var defaultProp = 0;
128                            var to = data[prop];
129                            if (to == undefined) return;
130                            if(prop=="scale" || prop=="scaleX" || prop=="scaleY" || prop=="scaleZ" ) {
131                                defaultProp = 1;
132                            }
133                            else {
134                                to = to | 0;
135                            }
136                            var prev = $el.data("_" + prop);
137                            if (prev == undefined) prev = defaultProp;
138                            var next = ((to-defaultProp) * ((scrollCurrent - scrollFrom) / (scrollTo - scrollFrom))) + defaultProp;
139                            var val = prev + (next - prev) / smoothness;
140                            if(easing && currentTime>0 && currentTime<=totalTime) {
141                                var from = defaultProp;
142                                if($el.data("sens") == "back") {
143                                    from = to;
144                                    to = -to;
145                                    easing = easingReturn;
146                                    totalTime = totalTimeReturn;
147                                }
148                                val = $.easing[easing](null, currentTime, from, to, totalTime);
149                            }
150                            val = Math.ceil(val * this.round) / this.round;
151                            if(val==prev&&next==to) val = to;
152                            if(!properties[prop]) properties[prop] = 0;
153                            properties[prop] += val;
154                            if (prev != properties[prop]) {
155                                $el.data("_" + prop, properties[prop]);
156                                applyProperties = true;
157                            }
158                        }, this));
159                    }
160                    if (applyProperties) {
161                        if (properties["z"] != undefined) {
162                            var perspective = data["perspective"];
163                            if (perspective == undefined) perspective = 800;
164                            var $parent = $el.parent();
165                            if(!$parent.data("style")) $parent.data("style", $parent.attr("style") || "");
166                            $parent.attr("style", "perspective:" + perspective + "px; -webkit-perspective:" + perspective + "px; "+ $parent.data("style"));
167                        }
168                        if(properties["scaleX"] == undefined) properties["scaleX"] = 1;
169                        if(properties["scaleY"] == undefined) properties["scaleY"] = 1;
170                        if(properties["scaleZ"] == undefined) properties["scaleZ"] = 1;
171                        if (properties["scale"] != undefined) {
172                            properties["scaleX"] *= properties["scale"];
173                            properties["scaleY"] *= properties["scale"];
174                            properties["scaleZ"] *= properties["scale"];
175                        }
176  
177                        var translate3d = "translate3d(" + (properties["x"] ? properties["x"] : 0) + "px, " + (properties["y"] ? properties["y"] : 0) + "px, " + (properties["z"] ? properties["z"] : 0) + "px)";
178                        var rotate3d = "rotateX(" + (properties["rotateX"] ? properties["rotateX"] : 0) + "deg) rotateY(" + (properties["rotateY"] ? properties["rotateY"] : 0) + "deg) rotateZ(" + (properties["rotateZ"] ? properties["rotateZ"] : 0) + "deg)";
179                        var scale3d = "scaleX(" + properties["scaleX"] + ") scaleY(" + properties["scaleY"] + ") scaleZ(" + properties["scaleZ"] + ")";
180                        var cssTransform = translate3d + " " + rotate3d + " " + scale3d + ";";
181                        this._log(cssTransform);
182                        $el.attr("style", "transform:" + cssTransform + " -webkit-transform:" + cssTransform + " " + style);
183                    }
184                }, this));
185                if(window.requestAnimationFrame) {
186                    window.requestAnimationFrame($.proxy(this._onScroll, this, false));
187                }
188                else {
189                    this._requestAnimationFrame($.proxy(this._onScroll, this, false));
190                }
191            }
192        };
193        //if($(window).innerWidth() >= 1200){
194            ParallaxScroll.init();
195        //}
196    });
197})(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.