javascript - Bootstrap Modal Fade Out Animation -
i've added basic animation closing of modal box, zooms out element:
$(function(){ var $modal = $('.modal'); $modal.on('hide', function () { if (!$modal.isanimating) { // $('.modal-backdrop.in').fadeto(250, 0); // fade out backdrop var $target = $('#zoomout-target'); var pos = $target.offset(); pos.top -= $(window).scrolltop(); pos.left -= $(window).scrollleft(); $modal.css({top: pos.top, left: pos.left, transform: 'scale(0.1, 0.1)', opacity: 0}); $modal.isanimating = true; settimeout(function(){ $modal.modal('hide'); $modal.isanimating = false; }, 750); return false; } $modal.css({top: '', left: '', transform: '', opacity: ''}); }); });
the problem backdrop "hides" target element modal box zooms out.
so added commented line above $('.modal-backdrop.in').fadeto(250, 0);
fades out backdrop nicely, looks i'm missing because page freezes.
it seems backdrop still on, capturing of mouse events, etc, though transparent. backdrop not visible, making page unusable.
how can rid of backdrop @ end of fadeto
animation?
edit:
i noticed problem .modal-backdrop , .modal-scrollable overlays, snippet instead of offensive 1 resolves issue, there's has cleaner solution imo:
$('.modal-backdrop.in').fadeout(600, function(){ $('body').removeclass('modal-open'); $('.modal-backdrop').hide(); $('.modal-scrollable').hide(); }); // fade out backdrop
i'm using bootstrap 2.3.2 , bootstrap modal 2.2.5
tia
Comments
Post a Comment