Javascript Library.
Commands 0 |
---|
Execute function after the document is finished loading (Trigger when the document has finished loading. We can access the DOM elements. But sub-resources such as images, stylesheets, and frames are still loading).
_z.ready(function);
Returns: Object _z
_z(function);
Returns: function returning
You can disable this method by writing this code in Initial code:
<script type="text/javascript" src="_z.js" underZ> // disable execution in _z(function) _z.f.status(false); </script>
Make sure that no other library use _ sign, like Underscore Library.
As in v 1.0.1
_1(function);
Returns: Object _z
// change document title when the document is loaded
_z.ready(function () {
document.title = "Document is ready";
});
// show alert when the document is loaded
_z(function () {
alert("the document is loaded");
});
// print the title first thing in <body> when the document is loaded
_1(function () {
_z("body").prepend(document.title);
});
// you can also use function name
function newTitle() {
document.title = "DOM is loaded";
}
_z(newTitle);
// this returning only when the document is loaded.
function returnTest() {
return "Only when the document is loaded";
}
_z( returnTest ); // Only when the document is loaded
_z.ready( returnTest ); // _z
_1( returnTest ); // _z
_z( returnTest ) === _z; // false
_z.ready( returnTest ) === _z; // true
_1( returnTest ) === _z; // true
Use your own way.