Core Docs | Additional Modules Docs

sb.dom.onReady


@Description: Used to run a function when a DOM element becomes available
@File: sb.js
@Type: function
@Param: object o An object of parameters
o.id - A reference to the id of the DOM node you are questioning the availability of, e.g. #navigation is the the ID of the DOM node I am polling for.
@Example:
//In this example the onloaded function fires when the node with the id #navigation is available  the onloaded function, receives a this which is essentialy the element passed through sb.$
    sb.dom.onReady({
        id : '#navigation',
        onReady : function(){
            alert(this.innerHTML);
        },
        interval : 100,
        tries : 10,
        ontimeout function(el){
            alert(el+' not found');
        },
        args : ['one', 'two']
    });