5

Is it possible to scroll vertically a div without using scrollbar instead using only mousewheel up and down for scroll ?

I have a instance like ,

<div style="height:200px">
<div class="samplediv" style="overflow:scroll;overflow-y:hidden;height:1000px">
.
.
.
.    
</div>
</div>

such that bigger div lies inside the smaller div , i want to scroll up as well as down the inner div , but i wanna hide my vertical scroll , is that possible in anyway , i tried with event hooks for scroll , but event is not hooked.

8
  • 4
    Apart from the fact if it can or cannot be done it's not really a good practice. Commented Nov 26, 2013 at 13:36
  • 2
    Nobody tell him! Protect the standards. ;) Commented Nov 26, 2013 at 13:36
  • @CaptainCarl is correct. Users rely on the presence of a scrollbar to indicate that they can indeed scroll. You can perhaps alter the appearance of a scrollbar so that it fades when the div in question is not hovered over. Either way, it's a fair bit of CSS (quite possibly JS) trickery. Commented Nov 26, 2013 at 13:37
  • @captaincarl yes i know, the real thing is that i have a common scrollbar for two divs , i used to hook an event for the other div using the other div's scroll bar , but when i mousewheel up an down on the div having no scroll bar , it does looks wierd .thats why i got stucked . Commented Nov 26, 2013 at 13:40
  • @joe_Benito Sorry guys , this is what you need but jsfiddle.net/7vbPh/1 Commented Nov 26, 2013 at 13:40

1 Answer 1

5

Please don't do this! It will make the interface unusable because no one will no where the can scroll!

But if you must...

How to Hide Your Scrollbars

jsFiddle Example

CSS

#wrapper {
    width: 150px;
    overflow: hidden;
    outline: 1px solid blue;
}

#scroller {
    width: 170px;
    height: 100px;
    overflow: auto;
    background: yellow;
}

HTML

<div id="wrapper">
    <div id="scroller">
        foo<br>bar<br>baz<br>foo<br>bar<br>baz<br>foo<br>bar<br>baz<br>
        foo<br>bar<br>baz<br>foo<br>bar<br>baz<br>foo<br>bar<br>baz<br>
        foo<br>bar<br>baz<br>foo<br>bar<br>baz<br>foo<br>bar<br>baz<br>      
    </div>
</div>
Sign up to request clarification or add additional context in comments.

2 Comments

yes i know the difficult on interface but i have a scroll bar in common for two divs , that was the problem , but i got your resource useful , and also i'm aware of standards you said ;)
Your comment made things clearer. I would have put that in the question. :)

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.