0

I want to make custom scroll for my div. I have write some code but it is not working fine. First of all it is on mousemove . This should be work like other scroll works. Fiddle

here is code

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})    

1 Answer 1

1

I changed your code a little,

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

Fiddle http://jsfiddle.net/v6qsu/2/

Also there are many libraries available which you could use for custom scrolling , like jscrollpane

http://jscrollpane.kelvinluck.com/

Sign up to request clarification or add additional context in comments.

1 Comment

plugins are too heavy. I just want to make my own with the help of your

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.