Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
144
rated 0 times [  148] [ 4]  / answers: 1 / hits: 19223  / 15 Years ago, fri, may 1, 2009, 12:00:00

I'm trying to resize my modal dialog window when certain items are hidden/shown.



window.resizeTo(800, 600);


I've tried using code like above, but it doesn't seem to work. I think because it is a modal dialog, and not a regular window. Any suggestions as to how I could resize this?


More From » dialog

 Answers
19

You'll want to identify the element or container ID and do something like this:



document.getElementById('MyModal').style.height = '500px';
document.getElementById('MyModal').style.width = '800px';


If you are using jQuery for this it can be quite a bit easier as you can attach it to the actual show modal function.



Edit

Within the javascript functions above, MyModal will be the ID of the container or modal. For example, if you are using a DIV for the outer element of your modal, you would set the DIV up like this:



<div id='MyModal' class=IFNEEDED>CONTENTS OF MODEL</div>


EDIT #2

Since this is not a modal as most would describe today, its more of a new window popup, this line of code should work for you (found it here):



window.open('http://www.pageresource.com/jscript/jex5.htm','mywindow','width=400,height=200')

[#99612] Monday, April 27, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
benitoh

Total Points: 150
Total Questions: 113
Total Answers: 104

Location: India
Member since Wed, Aug 26, 2020
4 Years ago
benitoh questions
Sun, Mar 21, 21, 00:00, 3 Years ago
Mon, May 13, 19, 00:00, 5 Years ago
;