Forum Moderators: open

Message Too Old, No Replies

Creating an auto resize popup window

New to JS and need help.

         

nigassma

10:13 pm on Jul 11, 2005 (gmt 0)

10+ Year Member



I was wondering what the best way to create a pop up window that resizes to the size of a page. The page will work like this...

whatever.htm has a bunch of headlines and a quick blurb about a topic. When the user clicks on the "read more..." link I would like a window to pop open that is resized to fit only the text and the image on that new page.

I figured that if I gave article1, article2, etc all specific widths and heights the JS/PHP needed to get the window to resize would be easier...

Help please?

nigassma

9:44 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



Any pointers or suggestions?

Dijkgraaf

10:31 pm on Jul 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are using window.open you can speficy the size of the windows in the features

window.open( [sURL] [, sName] [, sFeatures] [, bReplace])

window.open("Sample.htm",null, "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");

You would have to replace those with paremeters

e.g.
window.open("Sample.htm",null, "height="+articleheight+",width="+articlewidth+",status=yes,toolbar=no,menubar=no,location=no");

rocknbil

10:45 pm on Jul 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're asking the window to size to the content.

Which means you'll have to figure out some way of measuring the width and height of the content based on whatever type specifications will apply, either hard set by CSS or influenced by the user's text size settings, and include any wrapping, paragraph spacing, and extraneous margins/toolbars etc. that will be included.

For any browser.

I'm going to hang on this thread and watch, because if there's an answer to it I **REALLY** want to hear it! :-)


So you can gather my input is "can't be done."

nigassma

10:51 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



There's gotta be a way to do it... Well if you can give it css then you should be able to tell it to auto fit height and width... right? Isn't this why PHP came to be? To make answers to questions like this easy?! :)