UI. Shadow

Add shadow around a DOM element.  The element MUST BE in ABSOLUTE position.

Shadow can be skinned by CSS (see mac_shadow.css or drop_shadow.css).  CSS must be included to see shadow.

A shadow can have two states: focused and blur.  Shadow shifts are set in CSS file as margin and padding of shadow_container to add visual information.

Example

new UI.Shadow("element_id");
Summary
Add shadow around a DOM element.
Constructor, adds shadow elements to the DOM if element is in the DOM.
Destructor, removes elements from the DOM
Sets top/left shadow position in pixels
Sets width/height shadow in pixels
Sets shadow bounds in pixels
Sets shadow z-index
Displays shadow
Hides shadow
Removes shadow from the DOM
Focus shadow.
Blurs shadow.

initialize

initialize: function(element,
options)

Constructor, adds shadow elements to the DOM if element is in the DOM.  Element MUST BE in ABSOLUTE position.

Parameters

elementDOM element
optionsHashmap of options
  • theme (default: mac_shadow)
  • focus (default: true)
  • zIndex (default: 100)

Returns

this

destroy

destroy: function()

Destructor, removes elements from the DOM

Size and Position

setPosition

setPosition: function(top,
left)

Sets top/left shadow position in pixels

Parameters

toptop position in pixel
leftleft position in pixel

Returns

this

setSize

setSize: function(width,
height)

Sets width/height shadow in pixels

Parameters

widthwidth in pixel
heightheight in pixel

Returns

this

setBounds

setBounds: function(bounds)

Sets shadow bounds in pixels

Parameters

boundsan Hash {top:, left:, width:, height:}

Returns

this

setZIndex

setZIndex: function(zIndex)

Sets shadow z-index

Parameters

zIndexzIndex value

Returns

this

Render

show

show: function()

Displays shadow

Returns

this

hide

hide: function()

Hides shadow

Returns

this

remove

remove: function()

Removes shadow from the DOM

Returns

this

Status

focus

focus: function()

Focus shadow.

Change shadow shift.  Shift values are set in CSS file as margin and padding of shadow_container to add visual information of shadow status.

Returns

this

blur

blur: function()

Blurs shadow.

Change shadow shift.  Shift values are set in CSS file as margin and padding of shadow_container to add visual information of shadow status.

Returns

this

initialize: function(element,
options)
Constructor, adds shadow elements to the DOM if element is in the DOM.
destroy: function()
Destructor, removes elements from the DOM
setPosition: function(top,
left)
Sets top/left shadow position in pixels
setSize: function(width,
height)
Sets width/height shadow in pixels
setBounds: function(bounds)
Sets shadow bounds in pixels
setZIndex: function(zIndex)
Sets shadow z-index
show: function()
Displays shadow
hide: function()
Hides shadow
remove: function()
Removes shadow from the DOM
focus: function()
Focus shadow.
blur: function()
Blurs shadow.