Reputation: 53
I have a problem where my page scroll to the top after i hide the button element which opened the confirm dialog.
After a confirm doalog closes it scroll back scroll to the caller element. If no such element, scroll to the top instead. Can I prevent that scroll?
I've re-created my problem in js fiddle: https://jsfiddle.net/at6sLy2g/
$('#openDialog').on('click', function(){
$.confirm({
buttons: {
confirm: function () {
$('#openDialog').hide();
},
cancel: function () {
}
}
});
})
Upvotes: 0
Views: 1580
Reputation: 81
Add below lines to confirm popup configuration:
$.confirm({
scrollToPreviousElement: false, // add this line
scrollToPreviousElementAnimate: false, // add this line
buttons: {
confirm: function () {
$('#openDialog').hide();
},
cancel: function () {
}
}
});
Upvotes: 2