FixWheel

FixWheel

allows to create an instance that can be initialised and destroyed when needed usually initialized on document.ready or when mounting a root component and destroyed when a root component is unmounted

Methods

checkOverflow

checkOverflow(el) → {HTMLElement}

check the overflow. If it is scroll or auto, check the scrollOffset. If the element is scrollable, apply scrollTop, otherwise check the parentNode

Parameters:
Name Type Description
el HTMLElement

the starts a the event.target then any ancestor of that element

Returns:

Returns the original element or the next scrollable ancestor. Returns null if no element matched the criteria.

Type
HTMLElement

destroy

destroy() → {Boolean}

destroys the helper. removes the fix if it has been applied

Returns:

should always return false. Mainly used for debugging but can be used as a flag.

Type
Boolean

fixWheel

fixWheel(e)

the actual fix for the issue.

Parameters:
Name Type Description
e Object

mousewheel event

Properties
Name Type Description
deltaY Number

wheel delta on the y-axis (if undefined simply does nothing)

init

init(rootNode) → {Boolean}

this method applys the fix for wheel events in browsers with faulty implementation

Parameters:
Name Type Description
rootNode HTMLElement

a DOM node, usually document.body but can be any other root element.

Returns:

returns true when applied, otherwise false. Mainly used for debugging but can be used as a flag.

Type
Boolean

preventDefault

preventDefault(e)

prevent the default event

Parameters:
Name Type Description
e Object

mousewheel event