Class Element

Index

Methods

Methods

public addClass(element: HTMLElement, name: string): HTMLElement

Function: addClass Add a CSS class name to an element. Safe where element already has the class name.

Parameters: element - {DOMElement} A DOM element node. name - {String} The CSS class name to add.

Returns: {DOMElement} The element.

Parameters

  • element: HTMLElement
  • name: string

Returns

HTMLElement

public getHeight(element: HTMLElement): number

APIFunction: getHeight

Parameters: element - {DOMElement}

Returns: {Integer} The offset height of the element passed in

Parameters

  • element: HTMLElement

Returns

number

public getStyle(element: HTMLElement, style: any): any

APIFunction: getStyle

Parameters: element - {DOMElement} style - {?}

Returns: {?}

Parameters

  • element: HTMLElement
  • style: any

Returns

any

public hasClass(element: HTMLElement, name: string): boolean

Function: hasClass Tests if an element has the given CSS class name.

Parameters: element - {DOMElement} A DOM element node. name - {String} The CSS class name to search for.

Returns: {Boolean} The element has the given class name.

Parameters

  • element: HTMLElement
  • name: string

Returns

boolean

public remove(element: HTMLElement)

APIFunction: remove Remove the specified element from the DOM.

Parameters: element - {DOMElement}

Parameters

  • element: HTMLElement

public removeClass(element: HTMLElement, name: string): HTMLElement

Function: removeClass Remove a CSS class name from an element. Safe where element does not have the class name.

Parameters: element - {DOMElement} A DOM element node. name - {String} The CSS class name to remove.

Returns: {DOMElement} The element.

Parameters

  • element: HTMLElement
  • name: string

Returns

HTMLElement

public toggle(element: HTMLElement)

APIFunction: toggle Toggle the visibility of element(s) passed in

Parameters: element - {DOMElement} Actually user can pass any number of elements

Parameters

  • element: HTMLElement

public toggleClass(element: HTMLElement, name: string): HTMLElement

Function: toggleClass Remove a CSS class name from an element if it exists. Add the class name if it doesn't exist.

Parameters: element - {DOMElement} A DOM element node. name - {String} The CSS class name to toggle.

Returns: {DOMElement} The element.

Parameters

  • element: HTMLElement
  • name: string

Returns

HTMLElement

public visible(element: HTMLElement): boolean

APIFunction: visible

Parameters: element - {DOMElement}

Returns: {Boolean} Is the element visible?

Parameters

  • element: HTMLElement

Returns

boolean