Autoscroll在网页上走得太远了

时间:2016-09-06 20:58:07

标签: javascript jquery html css twitter-bootstrap

我正在测试一个引导程序网页,自动滚动在桌面上工作,但在移动设备上滚动到远处,使我的<h2>消失,只留下<p>个标签。

为什么向下滚动不会滚动到该部分的开头?

有人可以帮帮我吗?非常感谢

菜单:

<ul class="nav navbar-nav">
    <!-- Hidden li included to remove active class from about link when scrolled up past about section -->
    <li class="hidden">
        <a href="#page-top"></a>
    </li>
    <li>
        <a class="page-scroll" href="#about">Over</a>
    </li>
    <li>
        <a class="page-scroll" href="#Teams">Teams</a>
    </li>
    <li>
        <a class="page-scroll" href="#sponsoren">Sponsoren</a>
    </li>
    <li>
        <a class="page-scroll" href="#contact">Contact</a>
    </li>                
</ul>

部分:

<section id="about" class="content-section text-center">
    <div class="row">
        <div class="col-lg-8 col-lg-offset-2 wow fadeInDown" data-wow-delay=".2s "> 
            <h2>test</h2>
            <p>test</p>
        </div>
    </div>
</section>

的CSS:

.content-section{}

js:

// jQuery to collapse the navbar on scroll
function collapseNavbar() {
    if ($(".navbar").offset().top > 50) {
        $(".navbar-fixed-top").addClass("top-nav-collapse");
    } else {
        $(".navbar-fixed-top").removeClass("top-nav-collapse");
    }
}

$(window).scroll(collapseNavbar);
$(document).ready(collapseNavbar);

// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function() {
    $('a.page-scroll').bind('click', function(event) {
        var $anchor = $(this);
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1500, 'easeInOutExpo');
        event.preventDefault();
    });
});

0 个答案:

没有答案