Question

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

Était-ce utile?

La solution

clearInterval not clearInteval

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top