The Official Blog of Patcoola

Im just a dude watching over my parents,
and trying to make cartoons and video games from home.

Script: Z Index [JS API]

, By Patcoola

Script Title: zIndex
Programming Language: Java Script
Date Completed: 2013/05/01

Purpose: Provides a method of managing element depth.

Advertisement

Donate Now!

I don't always use the women's bathroom, but when I do, you can bet it really smells. If you like my blog, please consider donating.


Description: Manages the z-index of elements. Elements are targeted by element ID and are added to an index registry to cache the z-index value of the element instead of getting the computed z-index every time which is slow and inefficient.

Methods:

zIndex.getComputedById ( id );

Returns the computed z-index value of an element ID.

zIndex.setDefaultById ( id, zIndex );

Set the default z-index “Fall back” value for element ID. Adds index to registry.

zIndex.getDefaultById ( id );

Returns the set default z-index. Returns undefined if element ID has not be added to the index registry.

zIndex.setById ( id, zIndex );

Set the z-index of element ID, takes a number or value of default, auto or inherit.
If default index has not been set, the default “Fall back” index will be the current computed z-index before the defined index is set and added to index registry.

zIndex.getById ( id );

Returns the z-index of element ID. Returns undefined if element ID has not be added to the index registry.

zIndex.toggleById ( id, byIndex, withIndex );

Changes the z-index of element ID by an index with another index value. Often used to toggle the default index value with a given index.

zIndex.swapByIds ( byId, withId, [computed_b] );

Swaps the indexes of element ID with another element ID.
Optional argument computed_b default value false. If set to true, the index will be updated with the computed z-index. Note: If an element is not in the index registry, it will be added, the default and set index will be the computed index.

zIndex.removeId ( id );

Removes an entry from the index registry.

Zindex.empty();

Clears the index registry. Removes all entries.

Z-Index can be a number or default, auto or inherit.

 

Advertisement

Donate Now!

This might not be the best time, but making a blog is not easy. Would you consider donating?


 

Post Meta

Share Post

 

Comments: Write Comment

Be the first to write a comment.


Leave a Comment


All comments are reviewed before publishing. Comments must be related to the page topic, must not be spam, and must comply with the criminal code of Canada.