是否可以将dojox.mobile.View设置为高度100%?如何将dojox.mobile.View设置为高度100%
例子:http://jsfiddle.net/sLP4S/6/
使用dojox.mobile.ScrollableView,而不是工作。但我的意图是在视图上添加一个触摸事件,因此视图不需要滚动。
非常感谢提前。
是否可以将dojox.mobile.View设置为高度100%?如何将dojox.mobile.View设置为高度100%
例子:http://jsfiddle.net/sLP4S/6/
使用dojox.mobile.ScrollableView,而不是工作。但我的意图是在视图上添加一个触摸事件,因此视图不需要滚动。
非常感谢提前。
我不是很有才华的网页设计,但在100%的高度总是会带来麻烦。相反,我会以像素为单位获取文档高度,并从中减去标题,菜单等。然后以像素为单位给出绝对高度。
我知道这是旧的,但这是我如何做到的。我曾经提到什么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
}
});
});
我与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";
}
}
});
});
以编程方式设置高度没有问题,但我更喜欢css解决方案:http://jsfiddle.net/sLP4S/8/ – mbecker 2012-08-16 10:24:29