Closed nyrf closed 4 years ago
Hi,
Firstly thanks for using the Notiflix.
Could you please share an example of the code about this. I can not get the issue by this GIF so I can not reproduce it.
Thank you.
@furcan Sorry, i found out it was caused by turbolinks. i've add the codes and it works fine now, thanks.
document.addEventListener('turbolinks:before-cache', () => {
if ($('#NotiflixConfirmWrap').length > 0) {
$('#NotiflixConfirmWrap').remove()
}
}
@nyrf hi again,
All Notiflix modules have CSS animations to show or hide(also remove) themselves.
So, the Confirm module has 300 milliseconds of delay (cssAnimationDuration
, you can look at the documentation page for more info).
I think your navigation tool changing the route before the Confirm module removed.
Probably your solution works fine, but I can recommend adding a timeout function to the Confirm module callback function to wait for removed.
Just an example:
Notiflix.Confirm.Show(
'Notiflix Confirm',
'Do you agree with me?',
'Yes',
'No',
function(){ // Yes button callback
var routingTimeout = setTimeout(function(){
// your turbolink codes etc...
clearTimeout(routingTimeout);
}, 360); // => delay removing the Confirm module.
},
function(){
// No button callback
}
);
Thanks.
Thanks for your great library.