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 ???

here's the post with first question about it

有帮助吗?

解决方案

clearInterval not clearInteval

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top