使用Easyui dialog進行數據新增的時候,若是Y軸方向有滾動條,當關閉以前的時候,將滾動條拉到最下方,再次打開的時候,滾動條仍是定位在最下方。post
需求: 每次打開的時候dialog Y軸滾動條定位在上方。ui
如圖:url
HTML文件:spa
<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文件:code
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'); }