Page MenuHomeGitPull.it

class JX.Scrollbar
Javelin Documentation ()

Provides an aesthetic scrollbar.

This shoves an element's scrollbar under a hidden overflow and draws a pretty looking fake one in its place. This makes complex UIs with multiple independently scrollable panels less hideous by (a) making the scrollbar itself prettier and (b) reclaiming the space occupied by the scrollbar.

Note that on OSX the heavy scrollbars are normally drawn only if you have a mouse connected. OSX uses more aesthetic touchpad scrollbars normally, which these scrollbars emulate.

This class was initially adapted from "Trackpad Scroll Emulator", by Jonathan Nicol. See https://github.com/jnicol/trackpad-scroll-emulator.

Tasks

Builtin Events

  • invoke(type, more) — Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see @{function:JX.install} for documentation. Any arguments you provide will be passed to listener callbacks.
  • static listen(type, callback) — Static listen interface for listening to events produced by any instance of this class. See @{method:listen} for documentation.

Other Methods

Methods

invoke(type, more)
Inherited

JX.Base

Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see JX.install() for documentation. Any arguments you provide will be passed to listener callbacks.

Parameters
stringtypeEvent type, must be declared when class is installed.
...moreZero or more arguments.
Return
JX.EventEvent object which was dispatched.

static listen(type, callback)
Inherited

JX.Base

Listen for events emitted by this object instance. You can also use the static flavor of this method to listen to events emitted by any instance of this object.

See also listen() in JX.Stratcom.

JX.Base

Static listen interface for listening to events produced by any instance of this class. See listen() for documentation.

Parameters
stringtypeType of event to listen for.
functioncallbackFunction to call when this event occurs.
Return
objectA reference to the installed listener. You can later remove the listener by calling this object's remove() method.

construct(frame)

This method is not documented.
Parameters
frame
This method is not documented.

scrollTo(scroll)

Get the margin width required to avoid double scrollbars.

For most browsers which render a real scrollbar control, this is 0. Adjacent elements may touch the edge of the content directly without overlapping.

On OSX with a trackpad, scrollbars are only drawn when content is scrolled. Content panes with internal scrollbars may overlap adjacent scrollbars if they are not laid out with a margin.

Parameters
scroll
Return
intControl margin width in pixels.
Defined
lib/Scrollbar.js:30
Extends
JX.Base