You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

Window resize onload to maximum (100% width and height)

They have: 2 posts

Joined: Oct 2008

This might be a redundant post so please accept my apologies as I couldn't find the search page.

Can anyone tell me how to code (javascript?) in or head action so when my page loads it automatically resizes to 100% of the viewers browser window?

Thanks so much,
j

decibel.places's picture

He has: 1,500 posts

Joined: Jun 2008

Hi jules,

I think this code should help you:

<p style="margin-top: 50px"><h2>If Portfolio Window doesn't open, allow pop-ups and <a href='javascript:void(0);' onclick='window.open("http://portfolio.netsperience.org/main.php/v/admin/portfolio/","_blank","menubar=no,resizable=yes,scrollbars=yes,fullscreen=yes")'>click here</a></h2></p>

<p style="margin-top: 50px"><h3>If you don't want to view the Portfolio full screen in a new window, <a href="http://portfolio.netsperience.org/main.php/v/admin/portfolio/">click here</h3></a></p>

<script type="text/javascript">
<!--
window.open("http://portfolio.netsperience.org/main.php/v/admin/portfolio/","_blank","menubar=no,resizable=yes,scrollbars=yes,fullscreen=yes");
//-->
</script>

Welcome to TWF! Why don't you post an Introduction to tell us all a little about yourself?

[btw - the Search box is in the top right of the page, but requires a search term longer than 3 characters, so a search for "SEO" (for example) won't work...]

He has: 610 posts

Joined: May 2007

Not sure, but I think Jules wants a regular page to fill the viewport if the page is short. Sadly, pop-ups like this rarely work these days, due to the ubiquity of pop-up blockers.

There is a way to do this in CSS, if my hunch is correct. It only works when you have a single block to hold the content, but that's often the case:

See Cameron Adams's FooterStickAlt solution.

FWIW - I have just been trying to create a JavaScript solution for a page wrapped in multiple DIVs - and failed! Although page zoom is easy to calculate and adjust for in Opera, Firefox 3 and Internet Explorer 7 seem broken as far as JavaScript is concerned. Sad

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

decibel.places's picture

He has: 1,500 posts

Joined: Jun 2008

webwiz wrote:
Sadly, pop-ups like this rarely work these days, due to the ubiquity of pop-up blockers.

That's why I load the popup with a page with alternate links...

Try it...

He has: 610 posts

Joined: May 2007

P.S. Block elements automatically display at 100% width unless you specify otherwise, or use a "shrink-to-fit" display property (float; inline-block; table; table-cell).

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

They have: 2 posts

Joined: Oct 2008

Hi,

Thanks for all the replies. Actually, I just went with this:

<script language="JavaScript"><!--
if (window.screen) self.resizeTo(screen.availWidth,screen.availHeight);
//--></script>

I didn't want a popup per say just that my index page would load 100% of the viewers browser window. It's not that elegant but seems to work.

If anyone has a better one though I would love to see it as this one doesn't give me any control of menus or status bars.

Thanks again,
j