2015-12-28 133 views
1

我在github插件中添加了平滑滚动效果。平滑滚动插件不允许我向下滚动页面

github.com/simov/simplr-smoothscroll

我在呼叫出局添加效果:

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> 
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.0.6/jquery.mousewheel.min.js"></script> 
<script src="http://simov.github.io/simplr-smoothscroll/lib/jquery.simplr.smoothscroll.js"></script> 

然后,我添加了效果验证码:

$(function() { $.srSmoothscroll() }); 

在我做完这些后,我的页面不再滚动。它只是卷起来。为什么这不能正常工作?

我将此上的网站是这个网页从网站:

http://realtorcatch.com/test_index

,我想它的模型后:

http://www.templatemonster.com/demo/51054.html

在githubs网站,它说,用法是这样的:

$(function() { 
$.srSmoothscroll({ 
    // defaults 
    step: 55, 
    speed: 400, 
    ease: 'swing', 
    target: $('body'), 
    container: $(window) 
    }) 
}) 

虽然这并没有帮助我的情况。

有没有人有任何想法,为什么这不滚动下来?

+0

仍在寻找解决方案... – BigMan

回答

0

看起来你的插件正在追赶滚动条。在Smooth Scrolling

$(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; 
     } 
    } 
    }); 
}); 

详细信息:反而应该是一个插件,你可以很容易地使用这个片段实现它。

+0

我希望它有一个平滑的滚动,因为我向下滚动鼠标滚轮。如果您使用滚动条并转到页面底部然后向上滚动,我希望它能做类似的事情,但是同时向上和向下。 – Becky

+0

@Becky但与此同时,该插件干扰你的光滑滚动,我猜... –

+0

我只是不明白,因为这是插件应该是。无论如何解决它? – Becky

1

我有Zurb's Foundation Framework同样的问题和标准设置从你的CSS文件$.srSmoothscroll()变化body { height:100% }body { height: auto }。这解决了我在chrome47上的问题(win7/osX 10.9)。或改变目标选项参数使用包装DIV:

$.srSmoothscroll({ 
    target: $('wrapper') 
});