PageSourceSearch

https://www.ebtechnology.it/plugins/system/edsanimate/assets/viewportchecker.js

js ebtechnology.it collected 2026-10-09 02:44:57 UTC 2,074 bytes, 54 lines download raw bytes

1(function($){
2    $.fn.edsViewportChecker = function(useroptions){
3       
4        var options = {
5        	classToRemove: 'eds-scroll-hidden',
6            classToAdd: 'eds-scroll-visible',
7            offset: 75,
8            callbackFunction: function(elem){}
9        };
10        $.extend(options, useroptions);
11       
12        var $elem = this;            
13
14        this.checkElements = function(){
15            
16        	var	windowHeight = $(window).height(),
17            viewportTop = $(document).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                    $obj.removeClass(options.classToRemove);
41                    setTimeout(function(){
42                    	$obj.css('overflow', 'hidden');
43                    }, 250);
44                    options.callbackFunction($obj);
45                }
46            });
47        };
48        
49        $( window ).on( "scroll", $.throttle( 250, this.checkElements ) );
50        //For applying the onscroll part only after the user scroll atleast ones event after the item is in view port, just comment this out        
51        this.checkElements();
52        
53    };
54})(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.