PageSourceSearch

https://molene.fr/plugins/system/edsanimate/assets/viewportchecker.js

js molene.fr collected 2026-10-02 08:02:41 UTC 1,983 bytes, 50 lines download raw bytes

1(function($){
2    $.fn.edsViewportChecker = function(useroptions){
3       
4        var options = {
5            classToAdd: 'eds-scroll-visible',
6            offset: 75,
7            callbackFunction: function(elem){}
8        };
9        $.extend(options, useroptions);
10       
11        var $elem = this;            
12
13        this.checkElements = function(){
14            
15            var scrollElem = ((navigator.userAgent.toLowerCase().indexOf('webkit') != -1) ? 'body' : 'html'),
16            	windowHeight = $(window).height(),
17                viewportTop = $(scrollElem).scrollTop(),
18                viewportBottom = (viewportTop + windowHeight);
19
20            $elem.each(function(){
21                var $obj = $(this);
22                var scroll_offset = $obj.attr('eds_scroll_offset');
23                
24                if ($obj.hasClass(options.classToAdd)){
25                    return;
26                }
27
28                var elemTop = '';
29                if(scroll_offset != null && scroll_offset != ''){
30                	elemTop = Math.round( $obj.offset().top ) + Math.round(Number(scroll_offset) * $obj.height() * 0.01),
31                    	elemBottom = elemTop + ($obj.height());
32                }else{
33                	elemTop = Math.round( $obj.offset().top ) + Math.round(options.offset * $obj.height() * 0.01),
34                	elemBottom = elemTop + ($obj.height());
35                }
36
37                // Add class if in viewport
38                if ((elemTop < viewportBottom) && (elemBottom > viewportTop)){
39                    $obj.addClass(options.classToAdd);                    
40                    options.callbackFunction($obj);
41                }
42            });
43        };
44        
45        $( window ).on( "scroll", $.throttle( 250, this.checkElements ) );
46        //For applying the onscroll part only after the user scroll atleast ones event after the item is in view port, just comment this out        
47        this.checkElements();
48        
49    };
50})(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.