javascript - How can I make my slideshow fade? -
im trying edit current javascript file make image slideshow fade each other rather jumping picture picture. here current code:
var myimage=document.getelementbyid("myphoto"); var imagearray=["workone.jpg", "worktwo.jpg", "workthree.jpg"] var imageindex=0; function changeimage () { myphoto.setattribute("src", imagearray [ imageindex]); imageindex++; if (imageindex>=imagearray.length) { imageindex=0; } } var intervalhandle = setinterval(changeimage,4000); myphoto.onclick=function() { clearinterval(intervalhandle); }
you can use jquery here. check fadein
, fadeout
functions. can achieve raw javascript changing element's opacity gradually.
Comments
Post a Comment