1/*! 2 * liScroll 1.0 3 * Examples and documentation at: 4 * http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html 5 * 2007-2010 Gian Carlo Mingati 6 * Version: 1.0.2.1 (22-APRIL-2011) 7 * Dual licensed under the MIT and GPL licenses: 8 * http://www.opensource.org/licenses/mit-license.php 9 * http://www.gnu.org/licenses/gpl.html 10 * Requires: 11 * jQuery v1.2.x or later 12 * 13 */ 14 15 16jQuery.fn.liScroll = function(settings) { 17 settings = jQuery.extend({ 18 travelocity: 0.07, 19 direction: "left", 20 pauseOnMouse: true 21 }, settings); 22 return this.each(function(){ 23 var $strip = jQuery(this); 24 $strip.addClass("liScroll"); 25 26 var stripWidth = 0; 27 $strip.find("li").each(function(i){ 28 stripWidth += jQuery(this, i).outerWidth(true); // thanks to Michael Haszprunar and Fabien Volpi 29 }); 30 31 var $mask = $strip.wrap("<div class='mask'></div>"); 32 var $tickercontainer = $strip.parent().wrap("<div class='liScroll-container'></div>"); 33 var containerWidth = $strip.parent().parent().width(); //a.k.a. 'mask' width 34 $strip.width(stripWidth); 35 var totalTravel = stripWidth+containerWidth; 36 var defTiming = totalTravel/settings.travelocity; // thanks to Scott Waye 37 function scrollnews(spazio, tempo){ 38 39 if(settings.direction == "right"){ 40 if(spazio==stripWidth+containerWidth) 41 $strip.css("left", -stripWidth); 42 spazio=-spazio-20; 43 } 44 45 $strip.animate( 46 {left: '-='+ spazio}, 47 tempo, 48 "linear", 49 function(){ 50 $strip.css("left", containerWidth); 51 scrollnews(totalTravel, defTiming); 52 } 53 ); 54 } 55 scrollnews(totalTravel, defTiming); 56 57 if(settings.pauseOnMouse==true) 58 { 59 $strip.hover(function(){ 60 jQuery(this).stop(); 61 }, 62 63 function(){ 64 var offset = jQuery(this).offset(); 65 var residualSpace = offset.left + stripWidth; 66 if(settings.direction == "right"){ 67 residualSpace = -offset.left+containerWidth+20; 68 } 69 70 var residualTime = residualSpace/settings.travelocity; 71 scrollnews(residualSpace, residualTime); 72 }); 73 } 74 }); 75};
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.