Tracked elements

The template provides a way to handle tracking elements: those are absolutely positioned elements which are following another element in the document flow. They need to be repositioned everytime the user scrolls, for instance.

How to use it

To start tracking an element, use this jQuery method:

$(selector).trackElement(target, refreshFunc);

Target is the element which should be tracked, and refreshFunc the function which will refresh the tracking element's position (called with tracking element as 'this' and target as argument).

You can also stop tracking:

$(selector).stopTracking();

Set it and forget it

Tracking elements will automatically be removed when the tracked element is deleted

Methods

$(selector).trackElement(target, refreshFunc)

Make the current element track another element

Parameters

@param jQuery target the jQuery object of the target element
@param function refreshFunc the function to refresh position (called with tracking element as 'this' and target as argument)
If none, the tracking element will be aligned with its target

$(selector).stopTracking(clearPos)

Stop a element from tracking

@param boolean clearPos if true, will clean position styling (top & left)

$(selector).refreshTrackedElements()

Updated tracking elements within selection

$(selector).refreshInnerTrackedElements()

Update tracking elements in selection's inner elements

$(selector).getTrackers()

Returns the jQuery list of tracking elements