OK. I decided to see what was happening and used curl to get the source code through the Android view.
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.actwebdesigns.co.uk'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2'); $html = curl_exec($ch); echo $html;
The only element that has a landscape or portrait class is the html tag.
<html xmlns="http://www.w3.org/1999/xhtml" class="ui-mobile landscape min-width-320px min-width-480px min-width-768px min-width-1024px"><head><meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1"></html>
I also noticed that the framework does not automatically switch the class to rotation, so the following code works, which I tested.
<script type="text/javascript"> $(window).resize( function(){ $('html').toggleClass('landscape, portrait'); }); </script>
discard the above that has flaws.
<script type="text/javascript"> $(window).resize( function(){ var height = $(window).height(); var width = $(window).width(); var ob = $('html'); if( width > height ) { if( ob.hasClass('portrait') ) { ob.removeClass('portrait').addClass('landscape'); } }else{ if( ob.hasClass('landscape') ) { ob.removeClass('landscape').addClass('portrait'); } } }); </script>
using liitle from Tommi Laukkanen script, this works great.
source share