jQuery Smooth Scroll在网页中不起作用

时间:2016-09-13 07:54:57

标签: javascript jquery html scroll smooth-scrolling

我正在尝试在我的网页中使用jQuery内部平滑。我已经多次使用相同的代码而没有任何问题,但这次它不起作用。这是代码的相关部分 -

HTML -

public interface TransactRepViewRepository extends JpaRepository <TransactRepViewModel, Long> {
...
List<TransactRepViewModel> findByTerminalnameIgnoreCaseContainingAndClDateBetween(String terminalName, Date startDate, Date endDate) throws DataAccessException;
...
}

和JS代码 -

<html>
<head>
<title>Geokeep</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Montserrat">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto">
</head>
<body>
<section id="section1">
                    <h2 id="h2">A Million Small Things. One Bag</h2>
                    <h3 id="h3">Presenting Geokeep. The world's first recycled and solar-powered bag.</h3>
                    <a  href="#section2" class="button" id="bt1">Know More</a>
                </section>
                <section id="section2">
                    <span id="head">
                        Meet Geokeep
                    </span>
                    <span id="desc">
                        The Geokeep is packed with features that help you do your bit towards the protection of the environment.
                    </span>
                        <!--<img src="Images/DOS.png">-->
                </section>

请提出有效的解决方案。

1 个答案:

答案 0 :(得分:0)

https://stackoverflow.com/a/10450503/6259383

有一个名为jQuery ScrollTo的插件可以帮到你 http://demos.flesler.com/jquery/scrollTo/