动画滚动无法在Firefox中运行?

时间:2014-11-26 13:50:26

标签: javascript jquery html css twitter-bootstrap

HTML:

<div class="container-fluid hidden-md hidden-lg">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <div  style="z-index: 1;" class="visible-xs visible-sm"><a href="index.html"><img id="bizviz_logos" src="resources/images/logoaccses.png"  class="img-responsive" alt="Responsive image"></a></div>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
             <ul id="menu" class="nav navbar-nav navbar-right">


<li class="dropdown">
          <a href="#" class="dropdown-toggle" id="menu_scroll" data-toggle="dropdown">Support <b class="caret"></b></a>
          <ul class="dropdown-menu">
            <li><a href="downloadtrailversion.html">Download </a></li>
            <li><a href="blogs.html">Blog</a></li>
            <li><a href="whitepaper.html">Papers</a></li>
            <li><a href="gallery.html">Gallery</a></li>
            <li><a href="documentation.html">Document</a></li>
            <li><a href="licenseassistance.html">License</a></li>
            <li><a href="submitproblem.html">Problem</a></li>
            <li><a href="videos.html">Videos</a></li>
            <li><a href="faq.html" class="dropdown-toggle">FAQ</a></li>
          </ul>
        </li>

             </ul>
        </div>
    </div>

jQuery的:

$(document).on('click','#menu_scroll',function(e){
                event.preventDefault();

                $('.navbar-collapse.in').animate({scrollTop: 100}, 250);

})

如上所述我使用jquery进行滚动。当我点击我的网站标题中的菜单项(引导程序移动 - 切换按钮)...它在chrome中运行正常但在firefox中它不起作用(滚动没有发生)任何帮助将不胜感激..

1 个答案:

答案 0 :(得分:0)

试试此代码

$(document).ready(function () {

        // hide #back-top first
        $("#back-top").hide();

        // fade in #back-top
        $(function () {
            $(window).scroll(function () {
                if ($(this).scrollTop() > 100) {
                    $('#back-top').fadeIn();
                } else {
                    $('#back-top').fadeOut();
                }
            });

            // scroll body to 0px on click
            $('#topanimated a').click(function () {
                $('body,html').animate({
                    scrollTop: 0
                }, 800);
                return false;
            });
        });

    });

在按钮ID =&#34;后顶&#34;

中设置此ID