PageSourceSearch

https://www.cadillacjacksgaming.com/wp-content/plugins/dynamic-con…/jquery-inertiaScroll.js?ver=3.4.14

js cadillacjacksgaming.com collected 2026-09-25 04:38:42 UTC 3,763 bytes, 129 lines download raw bytes

1/**
2jquery-inertiaScroll
3
4Copyright(c) 2017 Go Nishiduka
5
6This software is released under the MIT License.
7http://opensource.org/licenses/mit-license.php
8
9Last Update: 2017-10-23
10Version:1.1.1
11*/
12
13'use strict';
14
15(function($){
16  $.fn.inertiaScroll = function(options){
17
18    //////////////////////////////////////////////////
19    // options
20    //////////////////////////////////////////////////
21
22    var settings = $.extend({
23      parent: '',
24      childDelta1: 0.02,
25      childDelta2: 0.1,
26      parentDelta: 0.08
27    }, options);
28
29
30    //////////////////////////////////////////////////
31    // jqeury object
32    //////////////////////////////////////////////////
33
34    var $window = $(window);
35    var $body = $('body');
36    var $parent = settings.parent;
37    var $child = this;
38
39    //////////////////////////////////////////////////
40    // inertiaScroll childClass
41    //////////////////////////////////////////////////
42
43    var ChildBox = function(elm, offset, speed, margin){
44      this.elm = elm;
45      this.offset = offset !== undefined ? offset : 0;
46      this.speed = speed !== undefined ? speed : 1;
47      this.margin = margin !== undefined ? margin : 0;
48    };
49    ChildBox.prototype.update = function(windowOffset,offsetBottom){
50      this.offset += (windowOffset * settings.childDelta1 * Number(this.speed) - this.offset) * settings.childDelta2;
51      this.elm.css({transform:'translate3d(' + 0 + ',' + ( Number(this.margin) - Number(this.offset) ) + 'px ,' + 0 +')'});
52    };
53
54    //////////////////////////////////////////////////
55    // inertiaScroll parentClass
56    //////////////////////////////////////////////////
57
58    var ParentBox = function(elm, offset, speed, margin){
59      ChildBox.apply(this,arguments);
60    };
61    ParentBox.prototype = Object.create(ChildBox.prototype,{
62      constructor:{
63        value: ParentBox
64      }
65    });
66    ParentBox.prototype.update = function(windowOffset){
67      this.offset += (windowOffset - this.offset) * settings.parentDelta;
68      this.elm.css({transform:'translate3d(' + 0 + ',' + (-this.offset) + 'px ,' + 0 + ')'});
69    };
70    ParentBox.prototype.setcss = function(){
71      this.elm.css({
72        'width':'100%',
73        'position':'fixed'
74      });
75    };
76
77    //////////////////////////////////////////////////
78    // make Object
79    //////////////////////////////////////////////////
80
81    var Boxes = function(){
82      this.ChildBox = [];
83      this.ChildBoxLength = 0;
84      this.ParentBox = '';
85      this.windowHeight = 0;
86    };
87    Boxes.prototype = {
88      init:function(){
89        this.createElm($child,$parent);
90        this.loop();
91      },
92      createElm:function(child,parent){
93        this.ParentBox = new ParentBox(parent,0,1);
94        this.ParentBox.setcss();
95        this.boxArrayLength = child.length;
96        for (var i = 0; i < this.boxArrayLength; i++) {
97          var e = child.eq(i);
98          var speed = e.data('speed');
99          var margin = e.data('margin');
100          this.ChildBox.push(new ChildBox(e,0,speed,margin));
101        }
102      },
103      smoothScroll:function(){
104        var windowOffset = $window.scrollTop();
105        var offsetBottom = windowOffset + this.windowHeight;
106        this.ParentBox.update(windowOffset);
107        for (var i = 0; i < this.boxArrayLength; i++) {
108          this.ChildBox[i].update(windowOffset,offsetBottom);
109        }
110      },
111      loop:function(){
112        this.smoothScroll();
113        window.requestAnimationFrame(this.loop.bind(this));
114      }
115    };
116
117    //////////////////////////////////////////////////
118    // Done
119    //////////////////////////////////////////////////
120    $(function(){
121      $body.height($parent.height());
122      var boxes = new Boxes();
123      boxes.init();
124    });
125
126    return this;
127
128  };
129})(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.