jquery accordion effect clearinterval error
-
20-04-2021 - |
Domanda
there's any bad thing getting timer in accordion script i'm using because when it starts and user go to another section in webpage, it's still working background. And if the user click in that function again it gets out out bounds.
A friend of mine told me I must put some code to prevent, but it doesnt work.
script
$(document).ready(function() {
if( window.accIId ) {
window.clearInterval( window.accIId );
}
$("#accordion1").msAccordion({defaultid:0, autodelay:4});
})
accordion.js
function startPlay() {
options.intervalid = window.setInterval(play, options.autodelay*1000);
window.accIId = options.intervalid;
};
function play() {
var sTitleId = options.alldivs_array[options.currentcounter];
openMe(sTitleId);
options.currentcounter++;
if(options.currentcounter==options.alldivs_array.length) options.currentcounter = 0;
};
function pause() {
window.clearInterval(options.intervalid);
};
What's te function for stopping ???
Soluzione
clearInterval
not clearInteval
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow