OpenLayers.Element - OpenLayers

# OpenLayers. Element

Summary

OpenLayers. Element |
Functions |
visible |
toggle | Toggle the visibility of element(s) passed in
hide | Hide element(s) passed in
show | Show element(s) passed in
remove | Remove the specified element from the DOM.
getHeight |
getDimensions |
hasClass | Tests if an element has the given CSS class name.
addClass | Add a CSS class name to an element.
removeClass | Remove a CSS class name from an element.
toggleClass | Remove a CSS class name from an element if it exists.
getStyle |

### Functions

### visible

> visible: function( | element | )

#### Parameters

element | {DOMElement}

#### Returns

{Boolean} Is the element visible?

### toggle

> toggle: function()

Toggle the visibility of element(s) passed in

#### Parameters

element | {DOMElement} Actually user can pass any number of elements

### hide

> hide: function()

Hide element(s) passed in

#### Parameters

element | {DOMElement} Actually user can pass any number of elements

### show

> show: function()

Show element(s) passed in

#### Parameters

element | {DOMElement} Actually user can pass any number of elements

### remove

> remove: function( | element | )

Remove the specified element from the DOM.

#### Parameters

element | {DOMElement}

### getHeight

> getHeight: function( | element | )

#### Parameters

element | {DOMElement}

#### Returns

{Integer} The offset height of the element passed in

### getDimensions

> getDimensions: function( | element | )

#### Parameters

element | {DOMElement}

#### Returns

{Object} Object with ‘width’ and ‘height’ properties which are the dimensions of the element passed in.

### hasClass

> hasClass: function( | element,
> | name | )

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.

### addClass

> addClass: function( | element,
> | name | )

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.

### removeClass

> removeClass: function( | element,
> | name | )

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.

### toggleClass

> toggleClass: function( | element,
> | name | )

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.

### getStyle

> getStyle: function( | element,
> | style | )

#### Parameters

element | {DOMElement}
style | {?}

#### Returns

{?}

> visible: function( | element | )

> toggle: function()

Toggle the visibility of element(s) passed in

> hide: function()

Hide element(s) passed in

> show: function()

Show element(s) passed in

> remove: function( | element | )

Remove the specified element from the DOM.

> getHeight: function( | element | )

> getDimensions: function( | element | )

> hasClass: function( | element,
> | name | )

Tests if an element has the given CSS class name.

> addClass: function( | element,
> | name | )

Add a CSS class name to an element.

> removeClass: function( | element,
> | name | )

Remove a CSS class name from an element.

> toggleClass: function( | element,
> | name | )

Remove a CSS class name from an element if it exists.

> getStyle: function( | element,
> | style | )

Close