0

I am having trouble with finding a good solution for pausing my setInterval(). Maybe I have build it up in a terrible way, but I am still learning. What I am trying to do is to pause the setInterval() on a hover/mouseover. I know I will have to use clearInterval() in some way, but I don't know how. Does anybody have any tips? This is what I am working with:

    var divs = $('.section').toArray();
    function getsectionNext() {
        divs.push(divs.shift());
        return divs[0];}
    function sectionInterval() {
        setInterval(function() {
            $('.section').removeClass('active');
            $(getsectionNext()).addClass('active');
        },10000);}
    setInterval(sectionInterval());

Thanks so much for any help in solving this problem!

0 Answers0