fn

jQuery. fn

Source:

jQuery extensions.

Methods

(static) cdAddCloseButton() → {external:jQuery}

Source:

Add a close button to the element.

Returns:
Type
external:jQuery

(static) cdGetText() → {string}

Source:

Get the element text as it is rendered in the browser, i.e. line breaks, paragraphs etc. are taken into account. This function is expensive.

Returns:
Type
string

(static) cdIsInViewport(partially) → (nullable) {boolean}

Source:

Check if the element is in the viewport. Elements hidden with display: none are checked as if they were visible. Elements inside other hidden elements return false.

This method is not supposed to be used on element collections that are partially visible, partially hidden, as it can't remember their state.

Parameters:
Name Type Description
partially boolean

Return true even if only a part of the element is in the viewport.

Returns:
Type
boolean

(static) cdRemoveNonElementNodes() → {external:jQuery}

Source:

Remove non-element nodes and metadata elements ('STYLE', 'LINK') from a jQuery collection.

Returns:
Type
external:jQuery

(static) cdScrollIntoView(alignmentopt, smoothopt, callbackopt) → {external:jQuery}

Source:

Scroll to the element if it is not in the viewport.

Parameters:
Name Type Attributes Default Description
alignment 'top' | 'center' | 'bottom' <optional>
'top'

Where should the element be positioned relative to the viewport.

smooth boolean <optional>
true

Whether to use a smooth animation.

callback function <optional>

Callback to run after the animation has completed.

Returns:
Type
external:jQuery

(static) cdScrollTo(alignmentopt, smoothopt, callbackopt) → {external:jQuery}

Source:

Scroll to the element.

Parameters:
Name Type Attributes Default Description
alignment 'top' | 'center' | 'bottom' <optional>
'top'

Where should the element be positioned relative to the viewport.

smooth boolean <optional>
true

Whether to use a smooth animation.

callback function <optional>

Callback to run after the animation has completed.

Returns:
Type
external:jQuery