PageSourceSearch

https://waresito.com/en/wp-content/themes/waresito/assets/js/sticky.js?ver=1.1

js waresito.com collected 2026-09-29 10:55:02 UTC 4,100 bytes, 97 lines download raw bytes

1/*
2 *  Stickr.js - v1.0.0
3 *  Contained Sticky Scrolling jQuery Plugin.
4 *  http://banago.github.io/Stickr.js/
5 *
6 *  @author Baki Goxhaj
7 *  @license MIT License
8 */
9;(function ( $, window, document, undefined ) {
10
11  "use strict";
12
13    // Create the defaults once
14    var pluginName = "stickr",
15      defaults = {
16            easing: 'linear',
17            duration: 500,
18            closeButton: false,
19            closeChar: 'ⓧ',
20            closeTop: 0,
21            closeRight: 0,
22            closest: null,
23            offsetTop: 0,
24            offsetBottom: 0,
25            queue: false
26            };
27
28    // The actual plugin constructor
29    function Plugin ( element, options ) {
30        this.element = element;
31        this.settings = $.extend( {}, defaults, options );
32        this._defaults = defaults;
33        this._name = pluginName;
34        this.init();
35    }
36
37    // Avoid Plugin.prototype conflicts
38    $.extend(Plugin.prototype, {
39        init: function () {
40                          
41                  var s = this.settings,
42                      el = $(this.element),
43                      namespace = el.prop('id').replace('-','') || 'stickr',
44                      parentEl = s.closest ? el.closest(s.closest) : el.parent(),
45                      relativeOffset = (el.offset().top - parentEl.offset().top) - s.offsetTop;
46                  
47                    el.css('position', 'relative');                                 
48                  
49                    if(s.closeButton === true)
50                  {
51                    el.append('<a class="close">' + s.closeChar + '</a>');
52                    el.find('.close').css({ 'position': 'absolute', 'top': s.closeTop + 'px', 'right': s.closeTop + 'px' });
53                    
54                    el.find('.close').on('click', function() {
55                      el.animate({ top: "0px" }, { queue: s.queue, easing: 'linear', duration: s.duration });
56                      $(window).off('scroll.' + namespace);
57                      $(this).remove();
58                    });
59                  }
60
61                    $(window).on('scroll.' + namespace, function(e) 
62                    {
63                        if($(window).scrollTop() > (parentEl.offset().top + relativeOffset) && ((parentEl.height() + parentEl.position().top) + s.offsetBottom) > ($(window).scrollTop() + el.height()))
64                        {
65                            //el.css( 'top', ($(window).scrollTop() - (parentEl.offset().top + relativeOffset)) + "px" );
66                            //console.log(($(window).scrollTop() - (parentEl.offset().top + relativeOffset)+el.height())+' >> '+$('.post-detail').height());
67                            if(($(window).scrollTop() - (parentEl.offset().top + relativeOffset)+el.height()) > $('.post-detail').height()){
68                              el.css('position', 'relative');
69                              el.fadeOut(100);
70                              //el.css('margin-top', $('.post-detail').height()-280+'px');
71                            }else{
72                            el.css('position', 'fixed');
73                            el.css('top', '100px');
74                              el.css('margin-top', '0');
75                              el.fadeIn(100);
76                            }
77                        }
78                        else if($(window).scrollTop() < parentEl.offset().top)
79                        {
80                          el.css('position', 'relative');
81                          el.css('top', '0');
82                        }
83                  });
84        }
85    });
86
87    // A really lightweight plugin wrapper around the constructor,
88    // preventing against multiple instantiations
89    $.fn[ pluginName ] = function ( options ) {
90        return this.each(function() {
91            if ( !$.data( this, "plugin_" + pluginName ) ) {
92                $.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
93            }
94        });
95    };
96
97})( jQuery, window, document );

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.