I have a working script like this:
jQuery(document).ready(function(){
$('.video-thumb img').bind('mouseover',function(){
var new = $(this).attr('src').replace(/default.jpg/,'1.jpg');
$(this).attr('src',new);
}).bind('mouseout',function(){
var default = $(this).attr('src').replace(/[0-9].jpg/,'default.jpg');
$(this).attr('src',default);
});
});
Yes, you guessed it. This made it possible to change the YouTube thumbnail to an interval. However, I have no idea how to create an interval. Now it changes the thumbnail to 1.jpg, which is another thumbnail, but then you need to change the image to 2.jpg in 1 second, etc.
The entire fragment should probably be written from scratch. Advice?
I hope you understand: -D
EDIT: I changed variable names from Finnish words, I don't use them. Only in this example.
Martti Lane
source
share