1(function ( $ ) { 2 var _ = { 3 lastScrollTop : 0, 4 direction: null, 5 }; 6 $.fn.lemniscate = function(options) { 7 console.log('----------', this.selector); 8 var defaults = { 9 container : this.selector, 10 }; 11 12 var o = $.extend( {}, defaults, options ); 13 $.fn.lemniscate._o = o; 14 startLoop = function(){ 15 $(window).on('scroll', handler.scroll); 16 $.fn.lemniscate.clone(); 17 }; 18 $.fn.lemniscate.clone = function(){ 19 var loop_clone = $(o.container).clone(); 20 $(o.container).parent().prepend( loop_clone ).append( loop_clone ); 21 setTimeout(function(){ 22 $.fn.lemniscate.startPosition(); 23 }, 200); 24 }; 25 $.fn.lemniscate.startPosition = function(){ 26 var center = $(o.container+':nth-child(2)').offset().top; 27 $(window).scrollTop(center); 28 }; 29 30 31 32 $.fn.lemniscate.destroy = function(){ 33 $(window).off('scroll'); 34 $(window).off('mousewheel'); 35 } 36 $.fn.lemniscate.debug = function(){ 37 console.log(defaults , options); 38 }; 39 40 startLoop(); 41 }; 42 43 var handler = { 44 scroll : function(){ 45 var down_clone = $($.fn.lemniscate._o.container+':last-child '), 46 win_height = $(window).height(), 47 win_width = $(window).width(), 48 winPos = $(window).scrollTop(), 49 clone_top = down_clone.offset().top, 50 loop_height = $($.fn.lemniscate._o.container).parent().outerHeight(true); 51 52 53 if(win_height + winPos >= loop_height ){ 54 var scroll_down_loop = down_clone.outerHeight(true) - win_height + (win_width * .03); 55 $(window).scrollTop(scroll_down_loop); 56 }else if(winPos <= 0 ){ 57 var scroll_up_loop = $($.fn.lemniscate._o.container).last().offset().top ; 58 $(window).scrollTop(scroll_up_loop); 59 } 60 61 } 62 }; 63 64 if ( typeof module === "object" && typeof module.exports === "object" ) { 65 module.exports = $.fn.lemniscate; 66 } 67}(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.