2012-08-16 122 views

回答

0

我不是很有才華的網頁設計,但在100%的高度總是會帶來麻煩。相反,我會以像素爲單位獲取文檔高度,並從中減去標題,菜單等。然後以像素爲單位給出絕對高度。

0

我知道這是舊的,但這是我如何做到的。我曾經提到什麼mbecker並創建了擴展常規視圖::

define([ 
    "dojo/_base/declare", 
    "dojo/dom", 
    "dojo/dom-geometry", 
    "dojo/dom-style", 
    "dojo/window", 
    "dojox/mobile/View", 
], function(declare,dom,domGeometry, domStyle, win,View){ 

    // module: 
    //  custom/widget/View2 
    console.log("Loading View2"); 

    return declare("custom.widget.View2", [View], { 
     tabName:"outertabbar", 

     resize: function(){ 
     //this is for a fixed tabbar 
      //if you dont have one remove this and the tabbox 
      var tabBar = dom.byId(this.tabName); 
      var tabBox = domGeometry.getMarginBox(tabBar); 

       var winBox = win.getBox(); 
      var height=winBox.h - tabBox.h + "px"; 
      domStyle.set(this.domNode, "height",height); 
      // summary: 
      //  Calls resize() of each child widget. 
      this.inherited(arguments); // scrollable#resize() will be called 

     } 
    }); 
}); 
0

我與ContentPaneResizeMixin發揮各地的新觀點,而是落戶在此。不要指望直接複製和粘貼 - 但這種模式將起作用。在這裏,我在頭文件中的dojoConfig中設置了一個來自服務器的變量。我檢測到桌面(通過phpMobileDetect)。

<script src="/dojo/dojo.js" type="text/javascript" data-dojo-config="parseOnLoad: false, async: 1, isDebug: 1, mblAlwaysHideAddressBar: false, has: { 'isDesktop': <?= json_encode($isDesktop) ?> }"></script> 

然後,我使用條件插件加載加載不同的基類,和一個小上漿邏輯取頭的照顧。繁榮。桌面本地獲取滾動條,iPad獲得可正常工作的ScrollablePane。

define([ 
    "dojo/_base/declare", 
    "dojo/_base/lang", 
    "dojo/has", 
    "dojo/has!isDesktop?dojox/mobile/Pane:dojox/mobile/ScrollablePane" 
], function(declare, lang, has, Pane) { 

    return declare("tt.app.ScrollableAwarePane", [ Pane ], { 


     resize: function(){ 
      this.inherited(arguments); 
      if(has('isDesktop')){ 
       this.containerNode.style.overflowY = "scroll"; 
       var height = rightPane.offsetHeight - this.getPreviousSibling().domNode.offsetHeight; 
       this.containerNode.style.height = height + "px"; 
      } 
     } 



    }); 

}); 
相關問題