Library: nornix.js
Overview
- source: nornix.js
Constructors
Namespaces
Namespace for Event functions
methods
- add(obj, type, fn, capture)
- remove(obj, type, fn, capture)
- cancel(e, c)
- delayedInit(id, initFunc, interval)
Namespace for CSS functions.
methods
- swap(el, oldstr, newstr)
- add(el, className)
- remove(el, className)
- contains(el, s)
- getPos(obj)
- getProperty(el, styleProp)
- prop2Js(p)
Namespace for DOM functions.
methods
- live2copy(collection)
- getTextContent(node)
- imagePreload(imgs, path)
- findChildOfType(nodes, nodeName, nodeAction, backwards)
- eqNodeName(el, nodeName)
Functions
Function to add events to objects.
parameters
| Object | obj | object to add the event to |
| String | type | event type, like "load", "click" |
| Function | fn | the function that should be run when the event fires |
| boolean | capture | if true, indicates that the user wishes to initiate capture |
Function to remove events from objects.
You should use the same parameters as in {@link event#addEvent} to remove the same event listener.
parameters
| Object | obj | object to add the event to |
| String | type | event type, like "load", "click" |
| Function | fn | the function that should be run when the event fires |
| boolean | capture | if true, indicates that the user wishes to initiate capture |
Function to stop normal browser action on events.
Function you can call within your event handlers to stop them performing
the normal browser action or kill the event entirely.
parameters
| Event | e | the event object |
| boolean | c | set to true to cancel event bubbling |
Function to run an initialization after an element
has became available in the DOM.
The element will be sent to the initializing function as an object.
parameters
| String | id | ID of element to wait for |
| Function | initFunc | the function that should be run when the element is available |
| number | interval | time in milliseconds |
Function to create a browser cookie.
parameters
| String | name | name of cookie |
| String | value | value of cookie |
| Number | days | number of days browser should save the cookie |
Function to read a browser cookie.
parameters
| String | name | name of cookie |
returns
| value of cookie |
Function to erase a browser cookie.
parameters
| String | name | name of cookie |
Function to swap, remove or add a class name on an object.
parameters
| HTMLElement | el | the object to work on |
| String | oldstr | the old class -- set to null to add class |
| String | newstr | the new class -- leave empty to remove class |
Function to add a class name on an object.
parameters
| HTMLElement | el | the object to work on |
| String | className | the new class |
Function to remove a class name from an object.
parameters
| HTMLElement | el | the object to work on |
| String | className | class to remove |
Check if class exists on element.
parameters
| HTMLElement | el | the object to work on |
| String | s | class name |
returns
| true if the class exists |
Get position of node.
parameters
| HTMLElement | obj | the object to work on |
returns
| absolute position as .x and .y of return value. |
Get current style of element.
parameters
| HTMLElement | el | element to get the style from |
| String | styleProp | CSS style propterty to fetch |
returns
| current setting of style property |
Convert CSS property to JS equivalent.
parameters
| String | p | property to convert |
returns
| JS property |
Create static copy of a live collection.
This makes it much faster to work with the elements.
parameters
| HTMLCollection | collection | a live collection |
returns
| static copy of the live collection |
Function that reads the text content of a DOM node.
IE FIX for .textContent
parameters
| Node | node | DOM node to get text content from |
returns
| text content of node |
Preload image files for faster rendering.
parameters
| Array | imgs | array of images |
| String | path | path to images |
Find first or last children of element type.
parameters
| HTMLElement | nodes | node, which children nodes will be searched |
| String | nodeName | type of HTML element we are looking for |
| Function | nodeAction | closure for action to execute |
| boolean | backwards | search from the end of the child list when true |
returns
| value of action closure. |
Check if node name of element is equal to a string.
parameters
| HTMLElement | el | the object to work on |
| String | nodeName |
returns
| true if the node name is equivalent |
String function that removes whitespace from the start and end of a string.
parameters
| String | s | the string to use |
returns
| String | the string with whitespace removed |
Objects
True when browser is Internet Exlorer.