我正在创建一个应该固定在页面底部的页脚。页脚正在创建但仅在调整窗口大小后才可见。以下是我的代码
<div id="footerContainerLexApp">
<div id="footerTitleBar" class="bold footerTitleBar">
<div>
<div class="form-group-margin">
<button type="button" class="btn-primary uiBMarginRight btn btn-root" style="min-width: 100px;">Save</button>
<button type="button" class="btn-primary uiBMarginRight btn btn-root" style="min-width: 100px;">Submit</button>
</div>
</div>
</div>
</div>
CSS:
.footerTitleBar {
position: relative;
padding: 0 0 20px 20px;
}
每次调整窗口大小时都会调用一个函数。
onResize: function () {
if(lexAppWidget.jqueryLoaded) {
var heightToBeReduced = 200;
if($("#tabviewMainContainerLexApp").is(":visible")) {
heightToBeReduced = 200;
}
var height = top && top.innerHeight ? top.innerHeight - heightToBeReduced : 800;
if(widget.containerScroller) {
widget.containerScroller.setSize({ height: height });
}
if($(".commonGridTable").length != 0) {
for(var i = 0; i < $(".commonGridTable").length; i++) {
if($($(".commonGridTable")[i]).attr('id') && $("#" + $($(".commonGridTable")[i]).attr('id').split("idCommonGridTable")[1]).is(':visible')) {
var containerWidth = widget.getElement("#" + $($(".commonGridTable")[i]).attr('id').split("idCommonGridTable")[1]).getSize().width
var widgetWidthonResize = (containerWidth - (0.02 * containerWidth));
$($(".commonGridTable")[i]).setGridWidth(widgetWidthonResize);
}
}
}
}
}
答案 0 :(得分:1)
我会考虑在onResize()
...中调用onLoad()
如果onResize
方法包含一些逻辑,那么这是一种常见的方法......