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