javascript - Jquery - append image to auto slide -
hey there created little slider :
http://jsfiddle.net/jtec5/379/
when hover throw "stop slide", autoslide stop´s:
var stopped=false; $("#slideshow > div:gt(0)").hide(); setinterval(function() { if(!stopped){ $('#slideshow > div:first') .fadeout(1000) .next() .fadein(1000) .end() .appendto('#slideshow'); } }, 2000); $('#stopslide').mouseover(function(){ stopped=true; // how append new picture here? }) $('#stopslide').mouseout(function(){ stopped=false; })
my question how append new image #stopslide while there mousover, wrote in code.. me in case?
greetings!!
check out updated fiddle @ http://jsfiddle.net/jtec5/381
i've added following in mouseover callback
template = $('<div></div>') .hide() .append( $('<img>').attr({ src : imageurl }) ) $("#slideshow").append(template);
the code creates div , appends img element src=imageurl it. you'd need set imageurl variable url of image want insert before template assignment. image added right before current element , show in following loops.
Comments
Post a Comment