[Elements] are optional
Defined in
Dom/Css/0.1/lib.js
Class SAPO.Dom.Css
class
SAPO.Dom.Css
Inclusion link: http://js.sapo.pt/SAPO/Dom/Css/0.1/
Sample: http://js.sapo.pt/SAPO/Dom/Css/sample/
Function Summary
add a class to a given element
Adds css style tags to the head section of a page
Adds a link tag for a stylesheet to the head section of a page
Gets the value for an element's style attribute
hide
(DOMElement|String
elm)
Hides an element
removes a class from a given element
sets the opacity of given client a given element
show
(DOMElement|String
elm)
Makes an element visible
Shows or hides an element depending on current state
add or remove a class name from a given element
Function Details
function addClassName
addClassName(DOMElement|String
elm, String
class)
add a class to a given element
Parameters:
elm
- DOM element or element id
class
name function appendStyleTag
Adds css style tags to the head section of a page
Parameters:
selector
- The css selector for the rule
style
- The content of the style rule
options
- Options for the tag -
String type- file type -
Boolean force- if true, style tag will be appended to end of head
function appendStylesheet
appendStylesheet(String
path, Object
options)
Adds a link tag for a stylesheet to the head section of a page
Parameters:
function decToHex
converts decimal to hexadecimal values, for use with colors
Parameters:
dec
- Either a single decimal value , an rgb(r, g, b) string
or an Object with r, g and b properties
Returns:
Hexadecimal value
function getStyle
Gets the value for an element's style attribute
Parameters:
elm
- DOM element or element id
style
- Which css attribute to fetch
Returns:
Style value
function hasClassName
Boolean
hasClassName(DOMElement|String
elm, String
class)
Parameters:
elm
- DOM element or element id
class
name
Returns:
true if a given class is applied to a given element
function hexToDec
Number
hexToDec(String
hex)
converts hexadecimal values to decimal, for use with colors
Parameters:
hex
- hexadecimal value with 6 or 2 characters
Returns:
Decimal value
function hide
hide(DOMElement|String
elm)
Hides an element
Parameters:
elm
- DOM element or element id function removeClassName
removeClassName(DOMElement|String
elm, String
class)
removes a class from a given element
Parameters:
elm
- DOM element or element id
class
name function setOpacity
setOpacity(DOMElement|String
elm, Number
value)
sets the opacity of given client a given element
Parameters:
elm
- DOM element or element id
value
- allows 0 to 1(default mode decimal) or percentage (warning using 0 or 1 will reset to default mode) function setStyle
setStyle(DOMElement|String
elm, String
style)
Sets the value for an element's style attribute
Parameters:
elm
- DOM element or element id
style
- Which css attribute to set function show
show(DOMElement|String
elm)
Makes an element visible
Parameters:
elm
- DOM element or element id function toggle
toggle(DOMElement|String
elm, Boolean
forceShow)
Shows or hides an element depending on current state
Parameters:
elm
- DOM element or element id
forceShow
- Forces showing if element is hidden function toggleClassName
toggleClassName(DOMElement|String
elm, String
className, Boolean
forceAdd)
add or remove a class name from a given element
Parameters:
elm
- DOM element or element id
className
- class name
forceAdd
- forces the addition of the class if it doesn't exists