Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
13 changes: 9 additions & 4 deletions demos/js/jquery.toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ if ( typeof Object.create !== 'function' ) {
if (this.canAutoHide()) {

var that = this;

window.setTimeout(function(){

var hideFunction = function (){
if ( that.options.showHideTransition.toLowerCase() === 'fade' ) {
that._toastEl.trigger('beforeHide');
that._toastEl.fadeOut(function () {
Expand All @@ -298,8 +296,15 @@ if ( typeof Object.create !== 'function' ) {
that._toastEl.trigger('afterHidden');
});
}
}

var timer = window.setTimeout(hideFunction, this.options.hideAfter);

}, this.options.hideAfter);
that._toastEl.hover(() => {
clearTimeout(timer);
}, () => {
timer = window.setTimeout(hideFunction, this.options.hideAfter);
})
};
},

Expand Down
13 changes: 9 additions & 4 deletions src/jquery.toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,7 @@ if ( typeof Object.create !== 'function' ) {
if (this.canAutoHide()) {

var that = this;

window.setTimeout(function(){

var hideFunction = function (){
if ( that.options.showHideTransition.toLowerCase() === 'fade' ) {
that._toastEl.trigger('beforeHide');
that._toastEl.fadeOut(function () {
Expand All @@ -304,8 +302,15 @@ if ( typeof Object.create !== 'function' ) {
that._toastEl.trigger('afterHidden');
});
}
}

var timer = window.setTimeout(hideFunction, this.options.hideAfter);

}, this.options.hideAfter);
that._toastEl.hover(() => {
clearTimeout(timer);
}, () => {
timer = window.setTimeout(hideFunction, this.options.hideAfter);
})
};
},

Expand Down