javascript - Resize a hidden Modal Popup -


i have hidden modal popup declared in html in following way:

<div id="rbe_popupcontainer" class="modal hide ui-resizable ui-draggable" style="overflow: hidden; position: fixed; display: none; width: 700px; height: 400px; margin-left: -350px; margin-top: -200px; left: 50%; top: 50%;" aria-hidden="true">    <div id="rbe_popupcontainerheader">      <div class="modal-header">        <button id="rbe_popclosebox" type="button" class="close" data-dismiss="modal" aria-hidden="true" style="display: block;">×</button> <span style="display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.4em;" id="rbe_popuptitle" class="large bold" title="attach">attach</span>       </div>    </div>    <div class="modal-body" id="rbe_popupiframecontainer" style="padding: 0px; overflow-x: hidden; height: 361px; width: 700px;">      <iframe src="../xyz.jsp?act=clean&amp;pageid=16238&amp;funcname=create23080" class="full-iframe" style="height: 361px; display: block; width: 700px; background-color: transparent;" frameborder="0" allowtransparency="true" id="rbe_popupframe"      name="rbe_popupframe"></iframe>      <div id="maskdiv" style="position:absolute;top:0px;left:0px;width:100%;height:100%;display:none">        <div></div>      </div>    </div>    <div class="ui-resizable-handle ui-resizable-e"></div>    <div class="ui-resizable-handle ui-resizable-s"></div>    <div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 1001;"></div>  </div>

and change modal popup size i.e. width , height when user clicks on button open modal using jquery. i've tried using:

$("#rbe_popupcontainer").on("show.bs.modal", function() {       var height = $(window).height() - 200;       alert(height);       $(this).find(".modal-body").css("max-height", height);     }); 

but doesn't seem work. best way resize modal popup window? suggestions?

your example should work, guess mistake need add + 'px' 'max-height':height+ 'px'.

therefore change jquery this:

$("#rbe_popupcontainer").on("show.bs.modal", function() {     var height = $(window).height() - 200;     alert(height);     $(this).find(".modal-body").css("max-height", height + 'px'); }); 

i created simple example here.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -