我正在尝试使用缓动效果来实现这种称为平滑页面滚动的漂亮效果。我按照本教程中的说明进行操作:http ://tympanus.net/codrops/2010/06/02/smooth-vertical-or-horizontal-page-scrolling-with-jquery/
我想做的只是能够单击导航栏中的链接之一,这将使我的页面垂直滚动(很好地)到确切的位置,但它不起作用。
希望大家能帮忙!提前致谢!!!
<!DOCTYPE html>
<html>
<head>
<title>Smooth Page Scrolling</title>
<script type='text/javascript' src='smoothpagescrolling.js'></script>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
</head>
<body>
<header>
<a href="#" id="logo">Logo</a>
<ul id="nav" class="nav">
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#gallery">Gallery</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</header>
<section id="hero1" class="hero">
<div class="inner">
<div class="copy">
<h1>Home</h1>
<p>Some text here!</p>
</div>
</div>
</section>
<section class="content">
<div class="inner">
<div class="copy">
<h1>About</h1>
<p>Some text here... </p>
</div>
</div>
</section>
<section id="hero2" class="hero">
<div class="inner">
<div class="copy">
<h1>Services</h1>
<p>Some text here... </p>
</div>
</div>
</section>
<section class="content">
<div class="inner">
<div class="copy">
<h1>Gallery</h1>
<p>Some text here... </p>
</div>
</div>
</section>
<section class="newsection">
<h1>Contact</h1>
<p>E-mail: webmaster@yahoo.com</p>
</section>
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Noto+Sans' rel='stylesheet' type='text/css'>
</body>
</html>