Bob
Bob

Reputation: 1

Scrollbar in div scroll instead of page scrollbar

I was building my site I can came across a little problem. I have a div with a fixed height and overflow:auto;. The height of the website will adjust itself to fit the page perfectly so that you dont get a scrollbar. My question is: Can I pass through the scroll event that happends in the page and redirect it to the scrollbar ? So in other words, when I scroll, not the page, but the scrollbar inside my div has to move.

I hope I made myself clear, if not, please ask for some more information.

With kindly regards, Bob

FIXED: The solution Andy brought up worked like a charm! Thank you and thanks all of you for your suggestions ^^.

Upvotes: 0

Views: 5803

Answers (3)

Phil
Phil

Reputation: 11175

This should work, I have used it in the past:

div {
        width:150px;
        height:150px;
        overflow:scroll;
    }

Upvotes: 3

Andy
Andy

Reputation: 30135

Here's an example of a possible solution:

http://jsfiddle.net/TTXqQ/

I'm using the Mousewheel Plugin

Upvotes: 1

Michael Mior
Michael Mior

Reputation: 28752

I believe the only way to do this is by fixing the content of everything else on the page and positioning your div such that it is in the "window" framed by the fixed content. If you can post your HTML, we may be able to help more.

Upvotes: 0

Related Questions