Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 关闭引导对话框后,滚动条消失_Javascript_Html_Css_Twitter Bootstrap - Fatal编程技术网

Javascript 关闭引导对话框后,滚动条消失

Javascript 关闭引导对话框后,滚动条消失,javascript,html,css,twitter-bootstrap,Javascript,Html,Css,Twitter Bootstrap,我的网站有问题。我正在使用Bootstrap3.2和Bootstrap对话框,而不是modals。当对话框打开时,有一个滚动条,但关闭它会使滚动条消失。我读过很多主题,但还没有找到有效的解决方案。有什么办法解决这个问题吗 这是我的对话代码: $("a.removeClass").click(function() { var uid = $(this).attr('id'); BootstrapDialog.show({ messa

我的网站有问题。我正在使用Bootstrap3.2和Bootstrap对话框,而不是modals。当对话框打开时,有一个滚动条,但关闭它会使滚动条消失。我读过很多主题,但还没有找到有效的解决方案。有什么办法解决这个问题吗

这是我的对话代码:

$("a.removeClass").click(function() {

        var uid = $(this).attr('id');   

        BootstrapDialog.show({
            message: 'Czy na pewno chcesz usunąć tą klasę?',
            title: 'Usuwanie klasy',
            buttons: [{
                label: 'Usuń klasę',
                cssClass: 'btn-danger',
                action: function(dialog) {
                    $(location).attr('href','index.php?app=admin&section=classes&uid=' + uid + '&remove');
                }
            }]
        });
    });
它也不起作用:

将此添加到CSS中:

.modal {
  overflow-y: auto;
}
/* custom class to add space for scrollbar */
.modal-scrollbar {
    margin-right: 15px;
}
这是给你的JS的:

(function($) {

$(document)
    .on( 'hidden.bs.modal', '.modal', function() {
        $(document.body).removeClass( 'modal-scrollbar' );
    })
    .on( 'show.bs.modal', '.modal', function() {
        // Bootstrap's .modal-open class hides any scrollbar on the body,
        // so if there IS a scrollbar on the body at modal open time, then
        // add a right margin to take its place.
        if ( $(window).height() < $(document).height() ) {
            $(document.body).addClass( 'modal-scrollbar' );
        }
    });

})(window.jQuery);
(函数($){
$(文件)
.on('hidden.bs.modal','.modal',function(){
$(document.body).removeClass('modal scrollbar');
})
.on('show.bs.modal','.modal',function(){
//Bootstrap的.modal打开类隐藏了主体上的任何滚动条,
//因此,如果在模态打开时主体上有一个滚动条,那么
//添加一个右边距以取代其位置。
如果($(窗口).height()<$(文档).height()){
$(document.body).addClass('modal scrollbar');
}
});
})(window.jQuery);

通过-

所以。。。问题是什么?欢迎来到SO。为了让人们更好地帮助你,你应该确保你的问题是明确的。同时发布相关代码,让社区知道您尝试了哪些解决方案。