i was wondering if there were any methods that would allow for my webpage to adjust to an iphone's or android's screen? i read about $(window).resize in What does $(window).resize do? JQuery Mobile, i read the documentation and am still confused. can someone provide an example for this?
Asked
Active
Viewed 5,084 times
1 Answers
2
$(window).resize(...)
binds a callback for the resize event or triggers this event.
Bind a callback function, if the users resizes the browser window:
$(window).resize(function() {
alert('resize handler called');
});
If you want to call all listeners manually (without any parameters):
$(window).resize();
=== UPDATE ===
Also see this example.
=== UPDATE ===
I don't think that you can resize the window, but you can change the zoom level by changing the viewport scale (untested):
function changeZoomLevel(iScale) {
var sViewport = '<meta name="viewport" content="width=device-width, initial-scale=' + iScale + '">';
var jViewport = $('meta[name="viewport"]');
if (jViewport.length > 0) {
jViewport.replaceWith(sViewport);
} else {
$('head').append(sViewport);
}
}
var iScale = 0.5 // set or calculate a zoom value between 0 and 1
changeZoomLevel(iScale);

scessor
- 15,995
- 4
- 43
- 54
-
would the last option resize the entire window automatically? – DasBoot Jul 06 '12 at 05:50
-
Never, only call the callbacks. – scessor Jul 06 '12 at 05:52