dojox.mobile.View を高さ 100% に設定することは可能ですか?
例: http://jsfiddle.net/sLP4S/6/
代わりに dojox.mobile.ScrollableView を使用すると機能します。しかし、私の意図はビューにタッチイベントを追加することであるため、ビューをスクロールする必要はありません。
よろしくお願いします。
dojox.mobile.View を高さ 100% に設定することは可能ですか?
例: http://jsfiddle.net/sLP4S/6/
代わりに dojox.mobile.ScrollableView を使用すると機能します。しかし、私の意図はビューにタッチイベントを追加することであるため、ビューをスクロールする必要はありません。
よろしくお願いします。
私は Web デザインの才能はあまりありませんが、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 をいじってみましたが、これに落ち着きました。単純なコピー アンド ペーストを期待しないでください。ただし、このパターンは機能します。ここでは、サーバーからの has 変数をヘッダーの 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>
次に、条件付きプラグイン ローダーを使用して別の baseClass をロードし、小さなサイズ変更ロジックを使用してヘッダーを処理します。ブーム。デスクトップはスクロールバーをネイティブに取得し、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";
}
}
});
});