Skip to content

Instantly share code, notes, and snippets.

@ternel
Created March 8, 2011 09:12
Show Gist options
  • Save ternel/860072 to your computer and use it in GitHub Desktop.
Save ternel/860072 to your computer and use it in GitHub Desktop.
function initTimeout()
{
var timeout_left = timeout_time;
var hasMove = false;
timeout = setInterval(function()
{
if (timeout_left <= 0 && isActive)
{
isActive = false;
$(document).bind('afterClose.facebox', function() {
isActive = true;
timeout_left = timeout_time;
});
$.facebox({
ajax: url_timeout
});
}
if (hasMove)
{
hasMove = false
}
else
{
timeout_left -= 1;
}
}, 1000);
$(document).mousemove(function () {
hasMove = true;
});
}
$(window).load(function()
{
initTimeout();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment