Roo/mobile/Mobile.js
authorAlan Knowles <alan@akbkhome.com>
Wed, 24 Nov 2010 08:13:45 +0000 (16:13 +0800)
committerAlan Knowles <alan@akbkhome.com>
Wed, 24 Nov 2010 08:13:45 +0000 (16:13 +0800)
Roo/mobile/Mobile.js

index 6c12fcd..41ab18f 100644 (file)
@@ -28,7 +28,7 @@ Roo.mobile.Mobile = function(cfg) {
 
 
 Roo.extend(Roo.mobile.Mobile, Roo.util.Observable, {
-    function init()
+     init: function()
     {
         //var page = iui.getSelectedPage();
         ///var locPage = getPageFromLoc();
@@ -38,7 +38,9 @@ Roo.extend(Roo.mobile.Mobile, Roo.util.Observable, {
         
         //if (locPage && (locPage != page))
         //    iui.showPage(locPage);
-        
+        Roo.get(document.head).createChild(
+            '<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>'
+        )
         //setTimeout(preloadImages, 0);
         if (typeof window.onorientationchange == "object")
         {
@@ -49,7 +51,7 @@ Roo.extend(Roo.mobile.Mobile, Roo.util.Observable, {
         this.checkOrientAndLocation.defer(0, this);
         this.checkTimer = setInterval(checkOrientAndLocation, 300);
     }
-    function orientChangeHandler()
+    orientChangeHandler: function()
     {
         if (window.orientation == 90 || window.orientation = -90) {
             this.setOrientation("landscape");
@@ -57,7 +59,13 @@ Roo.extend(Roo.mobile.Mobile, Roo.util.Observable, {
         }
         this.setOrientation("portrait");
         
-    }
+    },
+    
+    setOrientation: function (orient)
+    {
+        document.body.setAttribute("orient", orient);
+        setTimeout(scrollTo, 100, 0, 1);
+    },
 
 });