jQuery startInterval and clearInterval in different functions

I am attempting to build a somewhat OOP jQuery plugin. Everything is going great, but I can’t seem to get the start/pause function to implement correctly. I have the following 2 functions:

this.startAutoPlay = function() {
    var interval = setInterval(function() { 
    }, config.timing);

this.stopAutoPlay = function() {

I just need a way to access the interval variable from within the stopAutoPlay function.

Any pointers?

Source: oop

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.