页面垂直滚动时跳转

时间:2016-05-03 10:32:41

标签: javascript jquery html css twitter-bootstrap

我现在遇到了一个问题。在stackoverflow上遇到类似的问题。但是没有人可以帮助我。

问题是当我滚动它时,我的html页面正在跳跃。 如果内容小于页面的总高度,则不会跳转,但是当内容比页面的总高度略大时,它会开始跳跃

有什么可能的解决方案,如果有人可以帮助我一点。 在此先感谢。我正在使用bootstrap。

HTML

<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
            <div class="navbar-header">
                <a class="navbar-brand" rel="home" href="/welcome">
                    <img src="/resources/images/senabLogo.jpg">
                </a>
            </div>
            <!-- navbar-header -->
            <div class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li><a href="/welcome">Home</a>
                    </li>



                            <li><a href="/offers">Offers</a></li>
                            <li><a href="/settings">Settings</a></li>

                            <li class="dropdown menu-item">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Language</a>
                                <ul class="dropdown-menu">
                                    <li><a href="?language=en">EN</a></li>
                                    <li><a href="?language=sv">SV</a></li>
                                    <li><a href="?language=no">NO</a></li>
                                </ul>
                            </li>


                </ul>
                <!-- nav navbar-nav -->
                <div class="col-sm-3 col-md-3 pull-right">
                    <ul class="LoginDetailsH">

                            <li>Sales</li>
                            <li><a href="javascript:formSubmit()">Log out <span class="fa fa-sign-out">&nbsp;</span></a></li>
                            <li class="dropdown menu-item pull-right">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="fa fa-question-circle">&nbsp;</span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="https://intranet.senab.com/diskussioner/categories/listings/fsvb" target="_blank">View open and closed questions</a></li>
                                    <li><a href="https://intranet.senab.com/diskussioner/ask/sales-to-cash/fsvb" target="_blank">Ask a new question</a></li>
                                </ul>
                            </li>

                    </ul>
                    <!-- LoginDetailsH -->
                </div>
                <!-- col-sm-3 col-md-3 pull-right -->
            </div>
            <!-- collapse navbar-collapse -->
        </nav>

<div class="container">

</div>

</body>

CSS

.navbar-fixed-top {position:relative !important;}

我已经引用了以下内容

Prevent page from jumping while changing position of element on scroll function

How do I stop a web page from scrolling to the top when a link is clicked that triggers JavaScript?

0 个答案:

没有答案