Javascript 平滑滚动一页网站

Javascript 平滑滚动一页网站,javascript,jquery,html,css,scroll,Javascript,Jquery,Html,Css,Scroll,我在一个单页网站上工作,它使用不同的分区ID,而不是多页。它的工作很好,但我想有滚动顺利下到该部分,而不是只是静态地进入该页上的部分 Jsfiddle: #主{ 宽度:960px; 保证金:自动; } #标题{ 保证金:自动; 高度:75px; 宽度:960px; } .导航{ 宽度:自动; 浮动:对; 字体:普通16像素Futura,无衬线; 填充:15px; } 李国荣先生{ 列表样式:无; 浮动:左; 左边距:15px; 颜色:#000; } #零{ 宽度:自动; } #一个{ 宽度:自动

我在一个单页网站上工作,它使用不同的分区ID,而不是多页。它的工作很好,但我想有滚动顺利下到该部分,而不是只是静态地进入该页上的部分

Jsfiddle:

#主{
宽度:960px;
保证金:自动;
}
#标题{
保证金:自动;
高度:75px;
宽度:960px;
}
.导航{
宽度:自动;
浮动:对;
字体:普通16像素Futura,无衬线;
填充:15px;
}
李国荣先生{
列表样式:无;
浮动:左;
左边距:15px;
颜色:#000;
}
#零{
宽度:自动;
}
#一个{
宽度:自动;
}
#两个{
宽度:自动;
}
#三{
宽度:自动;
}
#四{
宽度:自动;
}
《洛雷姆·伊普苏姆》中有很多不同的段落,但大多数都经历了某种形式的变化,比如注入幽默,或者随机的词语,这些词语看起来甚至一点都不可信。如果你要使用LROM乱数假文,你需要确保在文本中间没有任何隐藏的尴尬。互联网上的所有Lorem Ipsum生成器都倾向于在必要时重复预定义的块,这使得它成为互联网上第一个真正的生成器。它使用了一本包含200多个拉丁单词的字典,并结合了一些典型的句子结构,生成了看起来合理的Lorem Ipsum。因此,生成的知识总是没有重复、注入的幽默或非特征词等

《洛雷姆·伊普苏姆》中有很多不同的段落,但大多数都经历了某种形式的变化,比如注入幽默,或者随机的词语,这些词语看起来甚至一点都不可信。如果你要使用LROM乱数假文,你需要确保在文本中间没有任何隐藏的尴尬。互联网上的所有Lorem Ipsum生成器都倾向于在必要时重复预定义的块,这使得它成为互联网上第一个真正的生成器。它使用了一本包含200多个拉丁单词的字典,并结合了一些典型的句子结构,生成了看起来合理的Lorem Ipsum。因此,生成的知识总是没有重复、注入的幽默或非特征词等

《洛雷姆·伊普苏姆》中有很多不同的段落,但大多数都经历了某种形式的变化,比如注入幽默,或者随机的词语,这些词语看起来甚至一点都不可信。如果你要使用LROM乱数假文,你需要确保在文本中间没有任何隐藏的尴尬。互联网上的所有Lorem Ipsum生成器都倾向于在必要时重复预定义的块,这使得它成为互联网上第一个真正的生成器。它使用了一本包含200多个拉丁单词的字典,并结合了一些典型的句子结构,生成了看起来合理的Lorem Ipsum。因此,生成的知识总是没有重复、注入的幽默或非特征词等

《洛雷姆·伊普苏姆》中有很多不同的段落,但大多数都经历了某种形式的变化,比如注入幽默,或者随机的词语,这些词语看起来甚至一点都不可信。如果你要使用LROM乱数假文,你需要确保在文本中间没有任何隐藏的尴尬。互联网上的所有Lorem Ipsum生成器都倾向于在必要时重复预定义的块,这使得它成为互联网上第一个真正的生成器。它使用了一本包含200多个拉丁单词的字典,并结合了一些典型的句子结构,生成了看起来合理的Lorem Ipsum。因此,生成的知识总是没有重复、注入的幽默或非特征词等

《洛雷姆·伊普苏姆》中有很多不同的段落,但大多数都经历了某种形式的变化,比如注入幽默,或者随机的词语,这些词语看起来甚至一点都不可信。如果你要使用LROM乱数假文,你需要确保在文本中间没有任何隐藏的尴尬。互联网上的所有Lorem Ipsum生成器都倾向于在必要时重复预定义的块,这使得它成为互联网上第一个真正的生成器。它使用了一本包含200多个拉丁单词的字典,并结合了一些典型的句子结构,生成了看起来合理的Lorem Ipsum。因此,生成的知识总是没有重复、注入的幽默或非特征词等

《洛雷姆·伊普苏姆》中有很多不同的段落,但大多数都经历了某种形式的变化,比如注入幽默,或者随机的词语,这些词语看起来甚至一点都不可信。如果你要使用LROM乱数假文,你需要确保在文本中间没有任何隐藏的尴尬。互联网上的所有Lorem Ipsum生成器都倾向于在必要时重复预定义的块,这使得它成为互联网上第一个真正的生成器。它使用了一本包含200多个拉丁单词的字典,并结合了一些典型的句子结构,生成了看起来合理的Lorem Ipsum。因此,生成的知识总是没有重复、注入的幽默或非特征词等

《洛雷姆·伊普苏姆》中有很多不同的段落,但大多数都经历了某种形式的变化,比如注入幽默,或者随机的词语,这些词语看起来甚至一点都不可信。如果你要使用LROM乱数假文,你需要确保在文本中间没有任何隐藏的尴尬。互联网上的所有Lorem Ipsum生成器都倾向于在必要时重复预定义的块,这使得它成为互联网上第一个真正的生成器。它使用了一本超过200个拉丁单词的字典,结合了一些典型的句子结构,
#main {
    width:960px;
    margin:auto;
}
#header {
    margin:auto;
    height:75px;
    width:960px;
}
.nav {
    width:auto;
    float:right;
    font:normal 16px Futura, sans-serif;
    padding:15px;
}
.nav ul li {
    list-style:none;
    float:left;
    margin-left:15px;
    color:#000;
}
#zero {
    width:auto;
}
#one {
    width:auto;
}
#two {
    width:auto;
}
#three {
    width:auto;
}
#four {
    width:auto;
}

<div id="header">
    <div class="nav">
        <ul> <a href="#zero"><li>About</li></a>
 <a href="#one"><li>Mobile</li></a>
 <a href="#two"><li>Print</li></a>
 <a href="#three"><li>Web</li></a>
 <a href="#four"><li>Contact</li></a>

        </ul>
    </div>
</div>
<div id="main">
    <div id="zero">
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
    </div>
    <div id="one">
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
    </div>
    <div id="two">
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
    </div>
    <div id="three">
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
    </div>
    <div id="four">
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
        <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
    </div>
</div>
<a href="#" onClick="scrollContent('some-div')">Link</a>

<script>
  function scrollContent(id) {
    $( 'html, body' ).animate({ scrollTop: $( '#' + id ).offset().top }, 900 );
  }
</script>