Hello,
   I'm trying to use the Javascript to change the orientation but it  
only works once or twice and then window.innerWidth doesn't change  
anymore.

I have an alert in the outer loop of the checking function that shows  
that the value doesn't change when I rotate the iPhone.

Any ideas?

Thanks,
ml

                        var checktimer;
                        var count = 0;

                        if(document.images) {
                                if(navigator.userAgent.indexOf("iPhone") != -1) 
{
                                        iphone = 1;
                                } else {
                                        iphone = 0;
                                }
                        }

                        addEventListener("load", function( event ) {
                                setTimeout( updateLayout, 0 );
                                checkTimer = setInterval( updateLayout, 10000 );
                        }, false);
                
                        var currentWidth = 0;
                        
                        function updateLayout() {
                                alert( "Checking: " + window.innerWidth );
                                if ( window.innerWidth != currentWidth ) {
                                        alert( "Updating layout: " + 
window.innerWidth );
                                        currentWidth = window.innerWidth;
                                        var orient = currentWidth == 320 ? 
"profile" : "landscape";
                                        document.body.setAttribute("orient", 
orient);
                                }
                        }                       


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to