JSL.dom

Handles all the DOM functions.

JLS.dom Code

Arguments

 * Selector
 * The argument can be the ID of an element, a DOM node reference or a CSS query.

JSL.dom.addClass( class_name )
Adds the given class to the currently selected items

Arguments

 * class_name
 * The class that must be added to the selected elements

JSL.dom.removeClass( class_name )
Removes the said class from all the element the selected list

Arguments

 * class_name
 * The class that must be removed from all the selected elements

JSL.dom.hasClass( class_name )
Returns true if the class given as the argument is present for the current element.

Arguments

 * class_name
 * The class name that be checked for in the current element

Returns
This function returns true if the class is there in this element and else if the class is not found.

JSL.dom.getPosition
Get the X,Y coordinates of the given element. Taken from http://txt.binnyva.com/2007/06/find-elements-position-using-javascript/

Returns
An associative array in this format -

JSL.dom.getStyle( property )
Get the specified style of the active element. Inspired by http://www.quirksmode.org/dom/getstyles.html

Arguments

 * property
 * The name of the property that must be fetched.

JSL.dom.setStyle( property, value )
Set the style of the element.

Arguments

 * property
 * The Property


 * value
 * The Value

JSL.dom.show( display )
Shows all currently selected elements.

Arguments

 * display
 * could be 'visible', 'inline' or 'block'. If you chose 'visible', the function changes the 'visibility' property instead of the 'display' property. Defaults to 'block'.

JSL.dom.hide( display )
Hides all the currently selected elements

Arguments

 * display
 * could be 'hidden', 'none'. If you chose 'hidden', the function changes the 'visibility' property instead of the 'display' property. Defaults to 'none'.

JSL.dom.toggle
Toggles the selected elements between hidden and displayed state. It the element is shown, one toggle call will make it hidden - and if its hidden, a toggle call will show it.

JSL.dom.on( event, function )
Attach an event to a function.

Arguments

 * event
 * The event to watch for.


 * function
 * The function that shoulb be called on that event.

JSL.dom.click( func )
Attach the click event to the specified function for all the selected elements

Arguments

 * func
 * The function that should be called on the 'onclick' event.

JSL.dom.load( func )
Attach the load event to the specified function. Usually its only used with the window element

Arguments

 * func
 * The function that should be called on document 'onload' event.

JSL.dom.get
Returns the base element