continuous scolling ticker - avoiding jumping?
I'm trying to get an infinite scrolling ticker type of thing working smoothly. To make it continuous开发者_运维技巧 I am removing the first element and replacing it at the back once it is out of view, but this makes the container element jump a little in the amount of time it takes to reposition the element.
see here: http://jsfiddle.net/rFwfN/
is there anyway around this? is there a better way of making this scrolling element continuous? I thought of cloning the set of elements so there are two, so making the dom switch less frequent.
http://jsfiddle.net/rFwfN/6/
You need to reset position before injecting:
var scrollone = function() {
$('carousel').tween('left',[0, (60 *-1)]);
$('carousel').setStyle('left', '0px').getFirst().inject($('carousel'));
}
$('carousel').getFirst().inject($('carousel'));
$('carousel').tween('left',[0, (60 *-1)]);
Not sure how to do with mootools. Tween must stop before element injection and begin once injection is done.
精彩评论