I developed a slideshow script called function slide()
. The intention is for this function to begin when the 'play' button is clicked and pause when the 'pause' button is clicked. I implemented setinterval and it functions properly, however, clearinterval does not seem to be working as expected. Can you pinpoint what mistake I might be making here?
<div id='play' onclick='play()'><img src='image1/fleche.png'></div>
<div id='pause' onclick='stop()'><img src='image1/break.png'></div>
function play(){
var test = setInterval(slide,500);}
function stop(){
clearInterval(test);}