HTML
<div class="modal fade" id="pleaseWaitDialog" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Calculating...
</div>
<div class="modal-body">
<div id="spinner"></div>
</div>
</div>
</div>
</div>
的Javascript
var dialog = $('#pleaseWaitDialog').modal({
keyboard: false,
backdrop: 'static',
show: false
});
//A checkbox
$('body').on('change', '.Foo', function () {
dialog.modal('show');
//Updates a Highchart using this.checked and this.id
dialog.modal('hide');
});
以上是一段代码,可让我在点击属于highchart
类的checkbox
时更新Foo
。在更新期间,它会弹出modal
,更新highChart
并关闭modal
。问题是,在modal
打开之前,正文自动滚动到页面顶部,我不想发生这种情况。我做错了什么?