Javascript 使用css和jquery的可滚动div

Javascript 使用css和jquery的可滚动div,javascript,jquery,css,Javascript,Jquery,Css,我想为我的div定制滚动条。我已经写了一些代码,但它不能正常工作。首先是在mousemove上。这应该是像其他滚动作品的工作 这是代码 var height = $('.frm').height(), overflowHeight= $('.overflow').height(); var finalheight = overflowHeight-height; $('.tab').mousemove(function(e){ var top= parseInt($('.tab').cs

我想为我的div定制滚动条。我已经写了一些代码,但它不能正常工作。首先是在mousemove上。这应该是像其他滚动作品的工作

这是代码

var height = $('.frm').height(),
overflowHeight= $('.overflow').height();    
var finalheight = overflowHeight-height;
$('.tab').mousemove(function(e){
var top= parseInt($('.tab').css('top'));
var ac= top;
$('.overflow').css({top:-ac})
var y= e.pageY;
$(this).css({top:y})    

我把你的密码改了一点

var height = $('.frm').height(),
overflowHeight= $('.overflow').height();    
var finalheight = overflowHeight-height;

$('.scroll').mousemove(function(e){
    var top= parseInt($('.tab').css('top'));
    var ac= top;
    $('.overflow').css({top:-ac})
    var y= e.clientY;
    $(".tab").css({top:y})  
});
拨弄

还有许多库可用于自定义滚动,如jscrollpane


插件太重了。我只想在你的帮助下做我自己的