Computer Science, asked by janajaivid1225, 1 year ago

Write a script to slide show the images by using settimeout() and cleartimeout() methods.

Answers

Answered by Atharva766
0
var pause = 3000; //interval, in milliseconds, between transitions var i = 0; //image counter //last index in 'imgs' array var imgCt = imgs.length - 1; var pic = document.getElementById("pic"); //the <img> element in the HTML file var timer; //rotate between the images in the "imgs" array function rotate() { pic.src = imgs[i]; if (i === (imgs.length -1)) { i = 0; } else { i++; } timer = setTimeout("rotate()", pause); } window.onload = rotate; //transitions either forward or backward function chgSlide(direction) { clearTimeout(timer) i += direction; if (i > imgCt) { i = 0; } if (i < 0) { i = imgCt; } pic.src = imgs[i];
}

This is the Java script codes
Answered by skavitha
0

Explanation:

Sorry.........i dont know the answer.....plz follow me

Similar questions