var initTweenJNews = function(){
posXstart = 0;
posXend = 0;
timerNews = 0; var timerInterval = 10000;
var width = jQuery('#maskUne').css('width');
max = width.length - 2;
width = width.substring(0, max);
//foreach #articleVignette a > mouseover
var tab = document.getElementById('articleVignetteUne').getElementsByTagName('a');
for(var i = 0; i < tab.length; i++)
{
tab[i].index = i;
tab[i].onmouseover = function(){
var index = this.index;
posXend = (width*(index)*-1);
//Animation + décélération
jQuery('#articleUne').animate({left: posXend - 20}, {queue: false, duration: 150}).animate({left: posXend }, {queue: false, duration: 250});
posXstart = posXend;
//Réinitiasation de nextNews
clearInterval(timerNews);
timerNews = setInterval('nextNews()', timerInterval);
} }
timerNews = setInterval("nextNews()", timerInterval);
}; function nextNews(){
var size = jQuery('#articleUne').css('width');
var width = jQuery('#maskUne').css('width');
max = size.length - 2;
size = size.substring(0, max);
max = width.length - 2;
width = width.substring(0, max);
posXend -= width;
if(posXend <= size*-1)
posXend = 0;
jQuery('#articleUne').animate({left: posXend -20}, {queue: false, duration: 150}).animate({left: posXend}, {queue: false, duration: 250});
posXstart = posXend;
};
|