Skip to content

Commit

Permalink
new feature to keep the toast around after hover-off for an extended …
Browse files Browse the repository at this point in the history
…1 second (customizable). The option is called extendedTimeOut
  • Loading branch information
johnpapa committed Jul 13, 2012
1 parent b581ee4 commit b2ca29f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion toastr.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
debug: false,
fadeIn: 300,
fadeOut: 1000,
extendedTimeOut: 1000,
iconClasses: {
error: 'toast-error',
info: 'toast-info',
Expand Down Expand Up @@ -106,6 +107,13 @@
})
}

var delayedFadeAway = function()
{
intervalId = setTimeout(fadeAway, options.extendedTimeOut)
}



var stickAround = function() {
clearTimeout(intervalId)
$toastElement.stop(true, true)
Expand All @@ -120,7 +128,8 @@
intervalId = setTimeout(fadeAway, options.timeOut)
}

$toastElement.hover(stickAround, fadeAway)
//$toastElement.hover(stickAround, fadeAway);
$toastElement.hover(stickAround, delayedFadeAway)

if (options.tapToDismiss) {
$toastElement.click(fadeAway)
Expand Down

0 comments on commit b2ca29f

Please sign in to comment.