0

I have a div with a fixed height and overflow-y : scroll which I am loading via ajax. I'm currently looking for a possibility to scroll the content inside the div (using the mouse wheel) but without displaying the scroll bar. Can anyone help?

3
  • Possible duplicate - stackoverflow.com/questions/11548072/… Commented Feb 14, 2013 at 14:38
  • 1
    You can easily achieve this playing with another parent DIV with overflow:hidden; just hiding the scrollbars beneath the right edge Commented Feb 14, 2013 at 14:40
  • yes, thank you. I would've never tought at this solution. Commented Feb 14, 2013 at 14:42

2 Answers 2

1

Another way is to use jquery.mousewheel : https://github.com/brandonaaron/jquery-mousewheel

On mouse wheel, compute scroll urself :

$('.toScroll').on('mousewheel',function(event, delta, deltaX, deltaY){
    if(!$(this).attr('data-scrolltop')){
        $(this).attr('data-scrolltop',0);
    }
    var scrollTop = parseInt($(this).attr('data-scrolltop'));
    scrollTop += (-deltaY * lineHeight);
    $(this).attr('data-scrolltop',scrollTop);
    $(this).scrollTop(scrollTop);
});

I made a Fiddle as a demonstration : http://jsfiddle.net/W2pZB/

The only problem is about the var-fixed line height.

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

Comments

0

You can do it by applying overflow:hidden and after display-none on the scroll-bar using css

And here you can find a same thing in below question .

jQuery: How do I scroll the body without showing the scroll bar?

1 Comment

as @jay suggested you can find a working fiddle also .. cheers :)

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.