javascript - Slideshow with timer -
i wondering if there anyway make slideshow of images countdown timer on slideshow.
i making exercise app, , need course option. on course option going show exercise 20 seconds, rest 10 seconds etc. until end of course.
i have exercises ready, in images. need code show image slideshow, countdown timer it.
thanks!
slideshow timer using setinterval()
method. try this:
<img src="some_source/to/file.png" alt="text" />
then can run function change src attribute as
setinterval(changeattr, 20000); function changeattr() { $('img').attr('src', 'next_image.png'); }
you can use if else
block change image like:
if($('img').attr('src') == 'some_image_file.png') { $('img').attr('src', 'new_image_file.png'); }
now timer execute each 20 seconds , change image's source attribute. use if else block determine image set slideshow image.
Comments
Post a Comment