Custom scroll bar visualization with HTML/CSS/JavaScript

后端 未结 2 1259
后悔当初
后悔当初 2020-12-23 23:25

I am creating a highly specialized application where I want to experiment with a custom scroll bar.

Ideally, I\'d disable the built-in scroll-bar and draw my own. Th

2条回答
  •  北海茫月
    2020-12-24 00:06

    I guess since this is highly specialized thing, there is no need to talk about usability :-)

    The only thing I am aware of is to implement your own event capture - based on keypress, mousedown etc. - it should be easy to get the current position of page (kind of virtual - because you will have everything loaded and just change the custom "viewport").

    I highly recommend checking great QuirksMode tutorials and docs:

    • Keypress events: http://www.quirksmode.org/js/keys.html

    • Mouse events: http://www.quirksmode.org/js/events_mouse.html

    I am not sure about scrolling wheel, though - I haven't heard about technique to emulate that, but surely you would be able to find or code something.

    EDIT: I have found some low-level JS implementation of scroll wheel (click wheel): http://www.switchonthecode.com/tutorials/javascript-tutorial-the-scroll-wheel

提交回复
热议问题