jquery - How to activate the Bootstrap modal-backdrop? -
i want put overlay on screen while ajax stuff running. building own overlay div isn't big deal, but, since i'm using bootstrap, figure might use .modal-backdrop -- should around, , there's value consistency , that.
the problem can't find right way -- i've tried adding classes .modal-backdrop, or calling .show() on it, it's not working.
note don't want bring whole modal dialog, reveal , hide backdrop.
any suggestions?
just append div class body, remove when you're done:
// show backdrop $('<div class="modal-backdrop"></div>').appendto(document.body); // remove (later) $(".modal-backdrop").remove(); live example:
$("input").click(function() { var bd = $('<div class="modal-backdrop"></div>'); bd.appendto(document.body); settimeout(function() { bd.remove(); }, 2000); }); <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" /> <script src="//code.jquery.com/jquery.min.js"></script> <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> <p>click button backdrop 2 seconds.</p> <input type="button" value="click me">
Comments
Post a Comment