我用overflow:hidden
風格來隱藏所有瀏覽器中的滾動條。並添加jquery函數按鈕用於向下滾動內容,其工作正常。我需要申請滾動頂部功能到其他按鈕或需要添加mousescroll需要JQuery的按鈕鼠標懸停滾動到頂部
$(document).ready(function() {
var count;
var interval;
$(".ca-top").on('mouseover', function() {
var div = $('.navbar-nav.categories');
interval = setInterval(function(){
count = count || 1;
var pos = div.scrollTop();
div.scrollTop(pos + count);
}, 10);
}).click(function() {
if (count < 6) {
count = count+1;
}
}).on('mouseout', function() {
// Uncomment this line if you want to reset the speed on out
count = 0;
clearInterval(interval);
});
});
檢查我的小提琴:https://jsfiddle.net/vuer5oyu/
簡單的代碼中傳遞的值: https://jsfiddle.net/vuer5oyu/ – Vishnu