模态对话框自动滚动到顶部

时间:2015-01-19 13:14:00

标签: javascript modal-dialog

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打开之前,正文自动滚动到页面顶部,我不想发生这种情况。我做错了什么?

0 个答案:

没有答案