CNET JS Code Documentation

Native: Element

Extends the Element native object to include the pin method useful for fixed positioning for elements.

Author: Aaron Newton

Element Method: pin

Affixes an element at its current position, even if the window is scrolled.

Arguments

  1. pin - (boolean, optional) true: pins the element; false: unpins the element; defaults to true; See also Element:unpin.

Syntax

$('myElement').pin();
 

Returns

  • (element) This Element.

Element Method: unpin

Un-pins an element at its current position (see Element:pin).

Syntax

$('myElement').unpin();
 

Returns

  • (element) This Element.

Element Method: togglepin

Toggles the pin state of the element.

Syntax

$('myElement').togglePin();
 

Returns

  • (element) This Element.