2012-08-16 117 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"; 
      } 
     } 



    }); 

}); 
相关问题