?
Solved

auto size a popup based on the contents

Posted on 2006-06-08
4
Medium Priority
?
3,878 Views
Last Modified: 2011-08-18
I am looking for a way i could resize my popup windows based on the content, i do not want a scrollbar there.

any ideas?
0
Comment
Question by:archrajan
  • 2
2 Comments
 
LVL 10

Accepted Solution

by:
0h4crying0utloud earned 2000 total points
ID: 16862682
This should work

<FORM>
<INPUT type="button" value="New Window!" onClick="window.open('http://www.pageresource.com/jscript/jex5.htm','mywindow','width=400,height=200,toolbar=yes,
location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,
resizable=no')">
</FORM>

in the popup code:

wrap you content in a div

<div id="content">
  everything...
</div>

get the offset height, width and resize:  (script must be after end body tag)

<script>

var content = document.getElementById("content");
window.resizeTo(content.offsetWidth + 30, content.offsetHeight + 50);

</script>


Good luck!

0
 
LVL 10

Expert Comment

by:0h4crying0utloud
ID: 16862689

ignore that first part i just meant to show that you first open your pop-up with no scrollbars
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question