是否可以将dojox.mobile.View设置为100%的高度?
示例:http://jsfiddle.net/sLP4S/6/
相反,使用dojox.mobile.ScrollableView是可行的。但我的意图是在视图上添加一个Touch-Event,因此视图不需要滚动。
在此之前,非常感谢您。
发布于 2012-08-16 09:59:36
我在网页设计方面不是很有天赋,但我及时了解到100%的高度总是会带来麻烦。相反,我会得到以像素为单位的文档高度,并从中减去页眉、菜单等。然后以像素为单位给出绝对高度。
发布于 2013-12-20 03:27:06
我知道这很老套,但我就是这么做的。我使用了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
}
});
});发布于 2014-03-29 01:41:08
我尝试了一下ContentPaneResizeMixin,但最终还是选择了这个。不要期望直接复制和粘贴-但是这个模式会起作用。在这里,我在头文件中的dojoConfig中设置了一个来自服务器的has变量。我检测桌面(通过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> 然后,我使用条件插件加载器加载不同的baseClass,并使用一些大小调整逻辑来处理头部。轰隆隆。Desktop原生获取scrollBars,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";
}
}
});
});https://stackoverflow.com/questions/11979687
复制相似问题