首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将dojox.mobile.View设置为高度100%

如何将dojox.mobile.View设置为高度100%
EN

Stack Overflow用户
提问于 2012-08-16 09:54:04
回答 3查看 885关注 0票数 0

是否可以将dojox.mobile.View设置为100%的高度?

示例:http://jsfiddle.net/sLP4S/6/

相反,使用dojox.mobile.ScrollableView是可行的。但我的意图是在视图上添加一个Touch-Event,因此视图不需要滚动。

在此之前,非常感谢您。

EN

回答 3

Stack Overflow用户

发布于 2012-08-16 09:59:36

我在网页设计方面不是很有天赋,但我及时了解到100%的高度总是会带来麻烦。相反,我会得到以像素为单位的文档高度,并从中减去页眉、菜单等。然后以像素为单位给出绝对高度。

票数 0
EN

Stack Overflow用户

发布于 2013-12-20 03:27:06

我知道这很老套,但我就是这么做的。我使用了mbecker提到的内容,并创建了一个扩展了常规视图的新视图::

代码语言:javascript
复制
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
EN

Stack Overflow用户

发布于 2014-03-29 01:41:08

我尝试了一下ContentPaneResizeMixin,但最终还是选择了这个。不要期望直接复制和粘贴-但是这个模式会起作用。在这里,我在头文件中的dojoConfig中设置了一个来自服务器的has变量。我检测桌面(通过phpMobileDetect)。

代码语言:javascript
复制
   <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> 

然后,我使用条件插件加载器加载不同的baseClass,并使用一些大小调整逻辑来处理头部。轰隆隆。Desktop原生获取scrollBars,iPad获取工作正常的ScrollablePane。

代码语言:javascript
复制
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";
            }
        }



    });

});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11979687

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档