Context.findByElement(element)
Parameters
element
: The scrollable HTMLElement of the context object you wish to find.
Returns
Context instance, or undefined
if no context is associated with the provided element.
Given an element on the page, this method returns the Context
instance associated with that element. If the element does not have an associated Context
, the method returns undefined
.
In this example we can create and destroy a waypoint inside a custom context. Another button shows us the result of calling findByElement
. Notice when the waypoint is created (and as a result the Context
is created) the method returns that Context
. When the waypoint is destroyed (which also destroys the Context
since it is empty) the call returns undefined
.
Waypoint