I am using
varName = setInterval(function() { ... }, 1000);
to set a couple of intervals in a jquery plugin that I'm writing, but when the plugin is reloaded I need to clear those intervals. I tried storing them in variables, like this:
(function($){
$.mosaicSlider = function(el) {
var base = this;
var transitionInterval, mainInterval;
...
base.init = function() {
mainInterval = setInverval(function() { ... }, 1000);
}
base.grid = function() {
this.transition() = function() {
transitionInterval = setInterval(function(...) {
}
}
base.init();
And I tried killing those intervals in the base.init() function, like this:
clearInterval(transitionInterval);
clearInterval(mainInterval);
And like this:
window.oldSetInterval = window.setInterval;
window.setInterval = new function(func, interval) { }
var transitionInterval, mainInterval;
out ofmosaicSlider
function after(function($){
. – Trotyl