new TrackElement(options)
Element Tracker Class for linking an object's x and y to the element position, relative to scroll.
Recommended for objects to be fixed: true to prevent any parent positioning from affecting the link to the element.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
object | Object containing properties to be applied to the new instance. Reference the properties below. |
- Mixes In:
- Source:
Properties:
| Name | Type | Default | Description |
|---|---|---|---|
element |
node | null | Element to be tracked |
Example
var scene = canvallax.Scene(),
rect = canvallax.Rectange({
fill: '#000',
width: 100,
height: 100
}),
tracker = canvallax.TrackElement('#myElement');
rect.addTo(scene,tracker);