mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 13:11:15 -07:00
Prevent closing modals when mouse drags outside
This commit is contained in:
parent
6a575824ef
commit
fc3a81a622
1 changed files with 17 additions and 0 deletions
|
@ -911,3 +911,20 @@ function toggleRevealTokens() {
|
|||
$('body').on('click', '.reveal-token', function() {
|
||||
_toggleRevealToken($(this), true);
|
||||
});
|
||||
|
||||
// https://stackoverflow.com/a/57414592
|
||||
// prevent modal close when click starts in modal and ends on backdrop
|
||||
$(document).on('mousedown', '.modal', function(e){
|
||||
window.clickStartedInModal = $(e.target).is('.modal-dialog *');
|
||||
});
|
||||
$(document).on('mouseup', '.modal', function(e){
|
||||
if(!$(e.target).is('.modal-dialog *') && window.clickStartedInModal) {
|
||||
window.preventModalClose = true;
|
||||
}
|
||||
});
|
||||
$('.modal').on('hide.bs.modal', function (e) {
|
||||
if(window.preventModalClose){
|
||||
window.preventModalClose = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue