2015-12-28 132 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') 
});