我有一个剃须刀部分视图,其中包含一个引导面板。它使用jquery加载到一个模态窗口中。通过设计,视图应该具有始终可见的标题和页脚部分,并且主体部分应该是可滚动的。我可以通过将div类=panel-body的高度设置为400 in来实现这一点,但我希望在模型打开之前在jquery中将其设置为根据模态窗口的高度确定的值,而我知道如何获得它。我的问题是如何使用jquery动态地将其应用于body部分?或者,换句话说:如何检测这个特定视图何时加载?
RoomingList.cshtml
<div id="panelRoomingList" class="panel panel-primary nopadding">
<div class="panel-heading">
</div>
<div id="panelBody" class="panel-body" style="height:400px; overflow-y:scroll">
</div>
<div class="panel-footer text-center" style="margin-top:30px;">
</div>
</div>
重要注意事项:伪脚本仅适用于编排。为了简单起见,它已经被缩短了,如果有任何代码错误,请忽略。原作品如预期的那样。
function ShowRoomingList() {
$.ajax({
url: ShowRoomingListUrl,
type: "GET",
cache: false,
success: function () {
$("#modal_RoomingList").modal("show");
$("#modal_RoomingList").html(data);
}
},
error: function (xhr, status, exception) {
DisplayAjaxError(xhr, status, exception); }
});
}
发布于 2016-01-11 09:02:08
使用ajax success
函数(在其中显示模型对话框)将动态属性(在您的情况下是高度)设置为模态对话框。
https://stackoverflow.com/questions/34688624
复制相似问题