Page 1 of 1
Scale to Browser Zoom
Posted: Mon Mar 31, 2014 8:15 pm
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.
Re: Scale to Browser Zoom
Posted: Mon Mar 31, 2014 9:48 pm
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.
Re: Scale to Browser Zoom
Posted: Mon Mar 31, 2014 11:36 pm
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.
Re: Scale to Browser Zoom
Posted: Tue Apr 01, 2014 4:51 am
by staartmees
Try a responsive webdesign with e.g. Foundation
Re: Scale to Browser Zoom
Posted: Tue Apr 01, 2014 5:59 pm
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...

Re: Scale to Browser Zoom
Posted: Tue Apr 01, 2014 6:40 pm
by KitchM
Yes, that link exemplifies exactly what I am wanting.