Scale to Browser Zoom

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Scale to Browser Zoom

Post by KitchM »

I am wanting to make sure my pages are staying within the browser window regardless of browser zoom level. In other words, I never want to see a horizontal scroll bar.

This code is seen in the stock template:

Code: Select all

//pass min and max - measured against window width
function P7_MinMaxW(a,b){
var nw="auto",w=document.documentElement.clientWidth;
if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;
Please explain this code to me. Am I correct in assuming this is where I would make the correct settings? Is this where one would set page constraints as a percentage of the available space?

Any explanation would be appreciated.

Thanks.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Scale to Browser Zoom

Post by velden »

The function result is pretty clear, but I'm not sure if it will help you.

You supply:
a (minimum width of something, e.g. 300)
b (maximum width of something, e.g. 700)

Function returns:

"auto" if browser window is between min and max
"300px" if browser window is less than or equals minimum pixels
"700px" if browser window is larger than or equals maximum pixels

Not sure if you should work around the scroll bar. If a visitor wants to zoom he probably has a reason to do that. If you're going to make things smaller, it will not be what visitor expects.
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Scale to Browser Zoom

Post by KitchM »

No, that's not how its supposed to work. The zoom should expand the contents of the page without the scrollbar coming into play. Properly done, the page contents should wrap within the screen borders while they get larger, pushing everything downward. Therefore, I would expect that the settings must have some sort of percentage control. Otherwise I'm not sure how that is done.

Maybe we need to study up at the W3C to figure this out.

Thanks.
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Scale to Browser Zoom

Post by staartmees »

Try a responsive webdesign with e.g. Foundation
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Scale to Browser Zoom

Post by Dr.CSS »

Like so..?

http://www.staceyjaswad.com/

The problem when talking about 'zoom' is that there is more than one way to think about it, the zoom that happens when you hold the Ctrl key and roll your mouse, and the others... ;)
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Scale to Browser Zoom

Post by KitchM »

Yes, that link exemplifies exactly what I am wanting.
Post Reply

Return to “Layout and Design (CSS & HTML)”