https://igda-gasig.org/wp-content/themes/icelander/assets/js/vendo…/jquery.scroll-watch.js?ver=1.7.6
1/** 2 * jQuery.scrollWatch 3 * 4 * @link https://github.com/webmandesign/scroll-watch 5 * @copyright WebMan Design, https://www.webmandesign.eu 6 * @license MIT, https://opensource.org/licenses/MIT 7 * @version 1.2.2 8 */ 9 10( function( $ ) { 11 12 'use strict'; 13 14 $.fn.scrollWatch = function( options ) { 15 16 // Helper variables 17 18 var 19 settings = $.extend( { 20 21 offset : 0, 22 placeholder : true, 23 fixWidth : true, 24 25 }, options ), 26 prototype = { 27 28 setWidth : function( $this ) { 29 if ( ! settings.fixWidth ) return; 30 31 $this 32 .css( 'width', $this.parent().outerWidth() + 'px' ); 33 }, 34 35 setHeightPlaceholder : function( $this ) { 36 if ( ! settings.placeholder ) return; 37 38 $this 39 .parent() 40 .css( 'height', $this.outerHeight() + 'px' ); 41 }, 42 43 }, 44 previousScrollTop = 0, 45 currentScrollTop = 0, 46 $window = $( window ), 47 $body = $( 'body' ); 48 49 50 // Processing 51 52 // Set the scroll direction body classes 53 54 $window 55 .on( 'load.scrollWatch scroll.scrollWatch', function() { 56 57 var 58 currentScrollTop = $window.scrollTop(); 59 60 // Window was scrolled? 61 62 if ( currentScrollTop ) { 63 $body 64 .removeClass( 'scrolled-not' ) 65 .addClass( 'scrolled' ); 66 } else { 67 $body 68 .removeClass( 'scrolled' ) 69 .addClass( 'scrolled-not' ); 70 } 71 72 // Scrolling direction 73 74 if ( currentScrollTop < previousScrollTop ) { 75 $body 76 .removeClass( 'scrolled-down' ) 77 .addClass( 'scrolled-up' ); 78 } else if ( currentScrollTop > previousScrollTop ) { 79 $body 80 .removeClass( 'scrolled-up' ) 81 .addClass( 'scrolled-down' ); 82 } 83 84 previousScrollTop = currentScrollTop; 85 86 } ); 87 88 89 // Output 90 91 return this.each( function( index ) { 92 93 // Requirements check 94 95 if ( 0 !== index ) return; // First element only. 96 97 98 // Helper variables 99 100 var 101 $this = $( this ), 102 elementID = ( $this.data( 'scroll-watch-id' ) || $this.attr( 'id' ) || $this.attr( 'class' ).split( ' ' )[0] ).trim().replace( /\s+/g, '-' ), 103 elementTop = $this.offset().top, 104 elementBottom = elementTop + $this.outerHeight(); 105 106 107 // Processing 108 109 // Set body class upon window scroll position in relation to stuck element 110 111 $window 112 .on( 'load.scrollWatch scroll.scrollWatch', function() { 113 114 var 115 currentScrollTop = $window.scrollTop(); 116 117 // Window is on top (no scroll)? 118 119 if ( currentScrollTop === 0 || currentScrollTop < settings.offset ) { 120 prototype.setHeightPlaceholder( $this ); 121 } 122 123 // Window was scrolled to the element? 124 125 if ( currentScrollTop > elementTop ) { 126 $body 127 .addClass( 'scrolled-to-' + elementID ); 128 } else { 129 $body 130 .removeClass( 'scrolled-to-' + elementID ); 131 } 132 133 if ( settings.offset ) { 134 if ( currentScrollTop > ( elementTop + settings.offset ) ) { 135 $body 136 .addClass( 'scrolled-to-' + elementID + '-offset' ); 137 } else { 138 $body 139 .removeClass( 'scrolled-to-' + elementID + '-offset' ); 140 } 141 } 142 143 // Window was scrolled past the element? 144 145 if ( currentScrollTop > elementBottom ) { 146 $body 147 .addClass( 'scrolled-past-' + elementID ); 148 } else { 149 $body 150 .removeClass( 'scrolled-past-' + elementID ); 151 } 152 153 if ( settings.offset ) { 154 if ( currentScrollTop > ( elementBottom + settings.offset ) ) { 155 $body 156 .addClass( 'scrolled-past-' + elementID + '-offset' ); 157 } else { 158 $body 159 .removeClass( 'scrolled-past-' + elementID + '-offset' ); 160 } 161 } 162 163 } ) 164 .on( 'resize.scrollWatch orientationchange.scrollWatch', function() { 165 166 // Reset variables 167 168 elementTop = $this.offset().top, 169 elementBottom = elementTop + $this.outerHeight(); 170 171 } ); 172 173 // Fixed element modifications 174 175 if ( settings.placeholder ) { 176 177 // Wrap the element with placeholder and set its height 178 179 if ( ! $this.parent().hasClass( 'scroll-watch-placeholder' ) ) { 180 $this 181 .wrap( '<div class="scroll-watch-placeholder ' + elementID + '-placeholder"></div>' ); 182 } 183 184 prototype.setHeightPlaceholder( $this ); 185 186 // Set the element width and reset it on window resize 187 188 prototype.setWidth( $this ); 189 190 $window 191 .on( 'resize.scrollWatch orientationchange.scrollWatch', function() { 192 193 // Reset stuck element width 194 195 prototype.setWidth( $this ); 196 197 // Reset stuck element placeholder height 198 199 $this 200 .parent() 201 .css( 'height', $this.outerHeight() + 'px' ); 202 203 // Reset variables 204 205 elementTop = $this.parent().offset().top, 206 elementBottom = elementTop + $this.parent().outerHeight(); 207 208 } ); 209 210 } 211 212 } ); 213 214 }; 215 216} )( 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.