Paul, We found that the "orientationchange" event didn't fire consistently enough or at the right times, so we hooked onto the "resize" event instead. If you try scrollTo(0,1) on a resize, it might work.
-- peter -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Paul at poles.fr Sent: Wednesday, July 21, 2010 8:04 AM To: iPhoneWebDev Subject: onorientationchange + scrollto Hi everyone, i've a problem that drive me crazy : I'm developping an iphone web site signdesign.fr/iphone. At first i wrote my code with <meta name="viewport" content="width=480">, so i had the same design in portrait and landscape. My "body" tag was enhance with body onload="window.scrollTo(x,y)" that worked well. Now i improve my html with : <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"> <body onorientationchange="updateOrientation();"> with the script : window.onload = function initialLoad(){ updateOrientation(); } function updateOrientation(){ contentType = "show_"; switch(window.orientation){ case 0: contentType += "portrait"; break; case -90: contentType += "landscape"; break; case 90: contentType += "landscape"; break; case 180: contentType += "portrait"; break; default: contentType += "portrait"; break; } document.getElementById("wrapper").setAttribute("class", contentType); } It's great, orientation change work fine! But now when i try to put "window.scrollTo(0,1);" in my updateOrientation() function it does work. Is somebody know how i can solve this problem? -- 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. -- 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.
