Type Definitions
finbarOnChange(index)
A callback function to be invoked whenever the scroll index changes.
- Specify a callback function in the
onchange
property of theoptions
object parameter to theFinBar constructor
. - Set or change the
onchange
property of yourFinBar
object directly.
The function you supply is invoked to handle the following events:
- Invoked once by calling the
index
setter - Invoked once by calling the
resize()
method - Invoked repeatedly as user drags the scrollbar thumb
- Invoked repeatedly as user spins the mouse wheel (but only when mouse pointer is positioned inside the
container
element) - If
.paging
: Invoked once when user clicks mouse in the page-up region (the area of the scrollbar above the thumb) - If
.paging
: Invoked once when user clicks mouse in the page-down region (the area of the scrollbar below the thumb)
The handler's calling context is the FinBar
object. Note that this includes:
- All the documented properties for the
FinBar
object - Any additional "custom" properties you may have included in the
options
object
And of course your handler will have access to all other objects in it's definition scope.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | The scrollbar index, always a value in the range |
finbarOptions
As an "options" object, all properties herein are optional. Omitted properties take on the default values shown; if no default value is shown, the option (and its functionality) are undefined. All options, including any miscellaneous ("custom") options, become properties of this
, the instantiated FinBar object. As such, they are all available to the onchange
callback function, which is called with this
as its context.
Type:
- object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
orientation |
number |
<optional> |
'vertical' | Overrides the prototype default. See |
range |
rangeType |
<optional> |
{min:0,max:100} | See |
max |
number |
<optional> |
100 | Overrides the prototype default. See |
index |
number |
<optional> |
min | Overrides the prototype default. See |
onchange |
finbarOnChange |
<optional> |
Overrides the prototype default. See |
|
increment |
number |
<optional> |
1 | Overrides the prototype default. See |
paging |
boolean |
<optional> |
true | Overrides the prototype default. See |
barStyles |
finbarStyles | null |
<optional> |
Overrides the prototype default. See |
|
deltaProp |
string | null |
<optional> |
'deltaY'|'deltaX' | Overrides the prototype default. See
|
classPrefix |
string |
<optional> |
Adds an additional classname to the bar element's class list. See |
|
container |
Element |
<optional> |
bar.parentElement | The element representing the content area. You only need to include this under special circumstances. Omitting this options assumes the container to be the scrollbar's parent element, as in the following typical configuration:
|
content |
Element |
<optional> |
This option is used to bind the scroll bar to some real content for the purpose of scrolling. Giving this option while omitting the
This property is not normally used for any other purpose. However, as with non-standard options, it will be mixed in to the object for future reference, such as in an onchange event handler. Therefore, if you do give a value for this option while also giving a value for the |
finbarStyles
Styles to be applied to scrollbar on resize.
Only enough of the above style properties need to be specified sufficient to place the scrollbar in its container. Specifically:
- For horizontal scrollbars, some combination of
left
and eitherwidth
orright
. - For vertical scrollbars, some combination of
top
and eitherheight
orbottom
.
Values for some or all of these may come from your stylesheets, in which case they may be omitted here.
Tip: Remember, CSS always measures values for
right
andbottom
backwards from their respective container edges. That is, positive values measure towards the left and top, respectively.
In addition to the properties listed below, you can also use any of the orientationHashType
pseudo-properties.
Regarding style values, the following to transformations are performed for your convenience:
- If style value is a number with no CSS unit specified, "px" is appended.
- If style value is a percentage and has margins, it is converted to pixel units, as a perentage of the scrollbar's parent element, minus its margins, with "px" appended. (CSS on its own does not consider margins part of the percentage.)
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
left |
number |
<optional> |
|
top |
number |
<optional> |
|
right |
number |
<optional> |
|
bottom |
number |
<optional> |
|
width |
number |
<optional> |
|
height |
number |
<optional> |
orientationHashType
In the following, two defaults are shown for each property, for the vertical and horizontal orientation hashes, respectively.
The description for each refers to the property relevant to the scrollbar's orientation.
Type:
- object
Properties:
Name | Type | Default | Description |
---|---|---|---|
coordinate |
string | 'clientY'|'clientX' | The name of the |
axis |
string | 'pageY'|'pageX' | The name of the |
size |
string | 'height'|'width' | The name of the scrollbar's |
outside |
string | 'right'|'bottom' | The name of the scrollbar's |
inside |
string | 'left'|'top' | The name of the scrollbar's |
leading |
string | 'top'|'left' | The name of the scrollbar's |
trailing |
string | 'bottom'|'right' | The name of the scrollbar's |
marginLeading |
string | 'marginTop'|'marginLeft' | The name of the scrollbar's |
marginTrailing |
string | 'marginBottom'|'marginRight' | The name of the scrollbar's |
thickness |
string | 'width'|'height' | The name of the scrollbar's |
delta |
string | 'deltaY'|'deltaX' | The name of the |
rangeType
A min/max range.
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
min |
number | |
max |
number |