Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.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_Jquery_Html_Css_Twitter Bootstrap - Fatal编程技术网

Javascript 引导模式移动到面板顶部单击

Javascript 引导模式移动到面板顶部单击,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,这是我以前问过的问题,但没有得到解决问题的答案。现在发生的事情是,我打开一个面板点击模态。模态打开时没有问题,但当我滚动到底部并单击移动到body的面板滚动到顶部时,问题就出现了 下面是代码的示例 以下是我正在使用的面板代码: <div class="panel"> <div class="panel-body" onclick="loadArticle('Metrico Release Date Announced', 'http://www.ign.com/arti

这是我以前问过的问题,但没有得到解决问题的答案。现在发生的事情是,我打开一个面板点击模态。模态打开时没有问题,但当我滚动到底部并单击移动到body的面板滚动到顶部时,问题就出现了

下面是代码的示例

以下是我正在使用的面板代码:

<div class="panel">
    <div class="panel-body" onclick="loadArticle('Metrico Release Date Announced', 'http://www.ign.com/articles/2014/07/16/metrico-release-date-announced')" data-toggle="modal" data-target=".bs-example-modal-lg">
        <h4>Metrico Release Date Announced</h4>
        <div class="news-item-background-image"></div>
        <br>
        <div class="article-info">
            <p class="text-muted pull-left">
                <img src="http://s1.wp.com/wp-content/themes/vip/techcrunch-2013/assets/images/favicon.ico" width="16px" height="16px">TechCrunch-1 hour ago</p><a href="#"><p class="text-muted pull-right category">Category</p></a>
        </div>
        <div class="clearfix"></div>
        <p>Metrico will be released on August 5 in the US exclusively on PS Vita, according to an announcement on the&nbsp;PlayStation Blog. Digital Dreams also announced that Palmbomen, a Dutch synth composer who has been featured in games like GTA V worked with the studio to create the soundtrack for Metrico.</p>
    </div>
    <!--/span-->
</div>
我知道这就是为什么会发生这种情况的原因,因为
position:fixed
没有顶部值,我猜它会移到顶部。如果不是这样,那么我应该如何解决问题


另外,上面的css修复了额外的滚动条问题。所以在回答时要记住这一点。只是一个提示!:)

因此,经过一段很长的时间,我找到了解决问题的方法,这就是我的解决方法(受公认答案的启发):

第一个绑定在隐藏并启用整个页面的滚动时调节modal事件,第二个绑定在显示并禁用整个页面的滚动时调节事件


简单。:)

“到顶部”按钮在哪里?在小提琴上找不到它!当我单击面板中每个
.article info
中的单词
类别
时,我只能在小提琴中重现“滚动到顶部”。这仅仅是因为它被包装在一个带有空锚链接的
标签中。删除此项,将不会再滚动到顶部。@Sebsemillia此问题仍然存在。@MohammadAreebSiddiqui您更改了什么?有更新的小提琴吗?
body.modal-open {
    overflow: visible !important;
    position: fixed;
    left: 0;
    width: 100%;
}
$('.bs-example-modal-lg').bind('hidden.bs.modal', function () {
    $("html").css("overflow", "visible");
});
$('.bs-example-modal-lg').bind('show.bs.modal', function () {
    $("html").css("overflow", "hidden");
});