phoenixgreg
Messages postés77Date d'inscriptionmardi 17 novembre 2009StatutMembreDernière intervention18 août 2015
-
7 juin 2011 à 11:40
phoenixgreg
Messages postés77Date d'inscriptionmardi 17 novembre 2009StatutMembreDernière intervention18 août 2015
-
11 juin 2011 à 12:02
Hi tt le monde !
Voilà j'ai mon petit script jquery liscroller, il fonctionne très bien, le texte défile mais j'aimerais qu'il défile à la vertical (direction = "up").
Sauf que je ne sais guère comment modifier ceci dans mon code :(.
jQuery.fn.liScroll = function(settings) {
settings = jQuery.extend({
travelocity: 0.07
}, settings);
return this.each(function(){
var $strip = jQuery(this);
$strip.addClass("newsticker")
var stripWidth = 0;
$strip.find("li").each(function(i){
stripWidth += jQuery(this, i).outerWidth(true); // thanks to Michael Haszprunar and Fabien Volpi
});
var $mask = $strip.wrap("
");
var $tickercontainer = $strip.parent().wrap("
");
var containerWidth = $strip.parent().parent().width(); //a.k.a. 'mask' width
$strip.width(stripWidth);
var totalTravel = stripWidth+containerWidth;
var defTiming = totalTravel/settings.travelocity; // thanks to Scott Waye
function scrollnews(spazio, tempo){
$strip.animate({left: '-='+ spazio}, tempo, "linear", function(){$strip.css("left", containerWidth); scrollnews(totalTravel, defTiming);});
}
scrollnews(totalTravel, defTiming);
$strip.hover(function(){
jQuery(this).stop();
},
function(){
var offset = jQuery(this).offset();
var residualSpace = offset.left + stripWidth;
var residualTime = residualSpace/settings.travelocity;
scrollnews(residualSpace, residualTime);
});
});
};
// ça c'est le script .js
<!-- Texte défilant pour les news -->
$(function(){ $("ul#ticker01").liScroll({travelocity: 0.12}); });