需要帮助缓慢css3中的滚动

时间:2015-02-04 05:04:40

标签: html5 css3 scroll effect

有人可以帮助我如何获得类似于此网站的滚动效果。 http://www.starworksgroup.com/ 我正在开发一个单页网站,其内容结构与参考网站类似。

2 个答案:

答案 0 :(得分:0)

这是一个JavaScript实现,使用CSS无法实现这一点。尝试禁用JS并刷新,观看它。

Here是该WP主题的JS文件的链接。

答案 1 :(得分:0)

实现jQuery 并添加此脚本:)

<script type="text/javascript">
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')        
&& location.hostname == this.hostname) {
  var target = $(this.hash);
  target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  if (target.length) {
    $('html,body').animate({
      scrollTop: target.offset().top
    }, 1000);
    return false;
    }
  }
});
});