使用Easyui dialog進行數據新增的時候,如果Y軸方向有滾動條,當關閉之前的時候,將滾動條拉到最下方,再次打開的時候,滾動條還是定位在最下方。
需求: 每次打開的時候dialog Y軸滾動條定位在上方。
如圖:

HTML文件:
<div id="mydialog" title="新建xxxx"
class="easyui-dialog" data-options="modal:true,closed:true,draggable:false"
style="width:945px;height:85%; margin: auto; display: none;">
<div id="tt" class="easyui-tabs" fit="true" fitColumns="true" border="true" style="width:auto;height:auto;">
<div title="基本信息" closable="false" border="true" id="tt_tabs_a">
<form id="xxxx" action="" method="post">
<input type="hidden" name="id" id="id" value="" />
<table class="formTable" style="width: 40%;">
。。。。
<tr>
<th>地址:</th>
<td><input id="address" type="text" name="address" style="width:310px;"
class="easyui-textbox" data-options="required:true"></input></td>
</tr>
<tr>
<th>郵箱:</th>
<td><input id="email" type="text" name="email" style="width:310px;"
class="easyui-textbox" data-options="required:false"></input></td>
</tr>
。。。
</table>
</form>
</div>
</div>
</div>
JS文件:
var currentTab = $('#tt').tabs('getSelected');
$("#tt").tabs("select",0);
RefreshTab(currentTab);
$("#tt_tabs_a").scrollTop(0);
//刷新當前標簽Tabs function RefreshTab(currentTab) { var url = $(currentTab.panel('options')).attr('href'); $('#tt').tabs('update', { tab: currentTab, options: { href: url } }); currentTab.panel('refresh'); }
