1/* 2* vertical news ticker 3* Tadas Juozapaitis ( kasp3rito [eta] gmail (dot) com ) 4* http://www.jugbit.com/jquery-vticker-vertical-news-ticker/ 5*/ 6(function($){ 7$.fn.vTicker = function(options) { 8 var defaults = { 9 speed: 700, 10 pause: 4000, 11 showItems: 3, 12 animation: '', 13 mousePause: true, 14 isPaused: false, 15 direction: 'up', 16 height: 0 17 }; 18 19 var options = $.extend(defaults, options); 20 21 moveUp = function(obj2, height, options){ 22 if(options.isPaused) 23 return; 24 25 var obj = obj2.children('ul'); 26 27 var clone = obj.children('li:first').clone(true); 28 29 if(options.height > 0) 30 { 31 height = obj.children('li:first').height(); 32 } 33 34 obj.animate({top: '-=' + height + 'px'}, options.speed, function() { 35 $(this).children('li:first').remove(); 36 $(this).css('top', '0px'); 37 }); 38 39 if(options.animation == 'fade') 40 { 41 obj.children('li:first').fadeOut(options.speed); 42 if(options.height == 0) 43 { 44 obj.children('li:eq(' + options.showItems + ')').hide().fadeIn(options.speed).show(); 45 } 46 } 47 48 clone.appendTo(obj); 49 }; 50 51 moveDown = function(obj2, height, options){ 52 if(options.isPaused) 53 return; 54 55 var obj = obj2.children('ul'); 56 57 var clone = obj.children('li:last').clone(true); 58 59 if(options.height > 0) 60 { 61 height = obj.children('li:first').height(); 62 } 63 64 obj.css('top', '-' + height + 'px') 65 .prepend(clone); 66 67 obj.animate({top: 0}, options.speed, function() { 68 $(this).children('li:last').remove(); 69 }); 70 71 if(options.animation == 'fade') 72 { 73 if(options.height == 0) 74 { 75 obj.children('li:eq(' + options.showItems + ')').fadeOut(options.speed); 76 } 77 obj.children('li:first').hide().fadeIn(options.speed).show(); 78 } 79 }; 80 81 return this.each(function() { 82 var obj = $(this); 83 var maxHeight = 0; 84 85 obj.css({overflow: 'hidden', position: 'relative'}) 86 .children('ul').css({position: 'absolute', margin: 0, padding: 0}) 87 .children('li').css({margin: 0, padding: 0}); 88 89 if(options.height == 0) 90 { 91 obj.children('ul').children('li').each(function(){ 92 if($(this).height() > maxHeight) 93 { 94 maxHeight = $(this).height(); 95 } 96 }); 97 98 obj.children('ul').children('li').each(function(){ 99 $(this).height(maxHeight); 100 }); 101 102 obj.height(maxHeight * options.showItems); 103 } 104 else 105 { 106 obj.height(options.height); 107 } 108 109 var interval = setInterval(function(){ 110 if(options.direction == 'up') 111 { 112 moveUp(obj, maxHeight, options); 113 } 114 else 115 { 116 moveDown(obj, maxHeight, options); 117 } 118 }, options.pause); 119 120 if(options.mousePause) 121 { 122 obj.bind("mouseenter",function(){ 123 options.isPaused = true; 124 }).bind("mouseleave",function(){ 125 options.isPaused = false; 126 }); 127 } 128 }); 129}; 130})(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.