Skip to content

Commit

Permalink
Ensure timer for delay starts on intial load (not after interaction)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewis-everley committed Jan 16, 2020
1 parent 1b7b6e6 commit 77ecf3b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/dist/js/SMModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
DelayTime = $(this).attr('data-delay');
$object = $(this);
if (DelayTime > 0) {
var idleTimer = null;
$('*').bind('mousemove click mouseup mousedown keydown keypress keyup submit change mouseenter scroll resize dblclick', function () {
var idleTimer = setTimeout(function () {
SMModal($object);
}, DelayTime * 1000);

$('*').bind('click mouseup mousedown keydown keypress keyup submit change scroll resize dblclick', function () {
clearTimeout(idleTimer);
idleTimer = setTimeout(function () {
SMModal($object);
Expand Down

0 comments on commit 77ecf3b

Please sign in to comment.