I'm using modal windows from Foundation and I have an alert every 3 seconds when it's opened. The point is I want to disable the interval when modal window is closed. I tried the following but clearInterval function doesn't seem to work (alert is still genarated after modal is closed):
$(document).on('opened', '[data-reveal]', function () {
var interval = setInterval(function(){alert("O.K.");}, 3000);
if($("div#automate_message").height() > 100) { interval; }
});
$(document).on('close', '[data-reveal]', function () {
clearInterval(interval);
});