This is library can detect when the complete DOM has been rendered. It can also load PAX scripts on the fly
Mikkel Bergmann, http://www.pointful.com
| pax.load | This is library can detect when the complete DOM has been rendered. |
| Properties | |
| pax.load | This library OBJ |
| pax. | True if the document DOM has loaded (excluding images and sub-documents). |
| pax. | List of functions to run when the document has loaded |
| Functions | |
| pax. | Loads a list of scripts, then calls the callback |
| pax. | Load CSS via ajax, and runs the callback when done. |
| pax. | Binds a function to launch when the DOM document is ready (excluding loading images and sub-documents); launches the function immediately if document is ready. |
pax.load.script = function( list, callback )
Loads a list of scripts, then calls the callback
| list | list of scripts that we want to load, this can be either the complete or relative path |
| callback | a function to run, when the scripts have loaded |
<span id="pax.script.example1">You should see a message pop up, then disappear after 5 seconds here: </span>
[:.
function showWindowAfterLoad() {
pax.box.showOnRight( 'myBox', 'This box is rendered via an asynchronously loaded library', 'hintMessage', pax.$('pax.script.example1'), 5 );
}
pax.load.script( '/pax/pax.box.js', showWindowAfterLoad );
:]Loads the pax.box library via ajax, and uses it to display a message box using <showBox>.
pax.load.css = function( url, callBack )
Load CSS via ajax, and runs the callback when done.
| url | The URL of the CSS you want to load |
| callBack | The method to run when the CSS has been loaded |
[:.
pax.load.css( '/pax/resource/pax_consolidated.css', function() { alert('Loaded CSS.'); } );
:]Loads some CSS, and alerts when done.
pax.load.onloaded = function( func )
Binds a function to launch when the DOM document is ready (excluding loading images and sub-documents); launches the function immediately if document is ready.
| func | Function that runs when the event fires |
var myFunc = function() {
alert('hello world!');
}
pax.load.onloaded( myFunc );Will alert when the DOM has loaded. Note that the example won’t run, as the document has already loaded
Loads a list of scripts, then calls the callback
pax.load.script = function( list, callback )
Load CSS via ajax, and runs the callback when done.
pax.load.css = function( url, callBack )
Binds a function to launch when the DOM document is ready (excluding loading images and sub-documents); launches the function immediately if document is ready.
pax.load.onloaded = function( func )