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 height = obj.children('li:first').height(); 36 } 37 38 obj.animate({ top: '-=' + height + 'px' }, options.speed, function() { 39 $(this).children('li:first').remove(); 40 $(this).css('top', '0px'); 41 }); 42 43 if (options.animation == 'fade') { 44 obj.children('li:first').fadeOut(options.speed); 45 if (options.height == 0) { 46 obj.children('li:eq(' + options.showItems + ')').hide().fadeIn(options.speed).show(); 47 } 48 } 49 50 clone.appendTo(obj); 51 }; 52 53 moveDown = function(obj2, height, options) { 54 if (options.isPaused) 55 return; 56 57 var obj = obj2.children('ul'); 58 59 var clone = obj.children('li:last').clone(true); 60 61 if (options.height > 0) { 62 height = obj.children('li:first').height(); 63 } 64 65 obj.css('top', '-' + height + 'px') 66 .prepend(clone); 67 68 obj.animate({ top: 0 }, options.speed, function() { 69 $(this).children('li:last').remove(); 70 }); 71 72 if (options.animation == 'fade') { 73 if (options.height == 0) { 74 obj.children('li:eq(' + options.showItems + ')').fadeOut(options.speed); 75 } 76 obj.children('li:first').hide().fadeIn(options.speed).show(); 77 } 78 }; 79 80 return this.each(function() { 81 var obj = $(this); 82 var maxHeight = 0; 83 84 obj.css({ overflow: 'hidden', position: 'relative' }) 85 .children('ul').css({ position: 'absolute', margin: 0, padding: 0 }) 86 .children('li').css({ margin: 0, padding: 0 }); 87 88 if (options.height == 0) { 89 obj.children('ul').children('li').each(function() { 90 if ($(this).height() > maxHeight) { 91 maxHeight = $(this).height(); 92 } 93 }); 94 95 obj.children('ul').children('li').each(function() { 96 $(this).height(maxHeight); 97 }); 98 99 obj.height(maxHeight * options.showItems); 100 } else { 101 obj.height(options.height); 102 } 103 104 var interval = setInterval(function() { 105 if (options.direction == 'up') { 106 moveUp(obj, maxHeight, options); 107 } else { 108 moveDown(obj, maxHeight, options); 109 } 110 }, options.pause); 111 112 if (options.mousePause) { 113 obj.bind("mouseenter", function() { 114 options.isPaused = true; 115 }).bind("mouseleave", function() { 116 options.isPaused = false; 117 }); 118 } 119 }); 120 }; 121})(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.