The core of My Library consists of one main file and two that add optional enhancements. The main file must appear first and is typically included in the head element. The main file may be downloaded in minified form or tailored to specific needs with the online builder. The optional enhancements are downloaded seperately and are typically included just before the end of body element. See the downloads page for more information.
This is an example of the typical structure:
<html> <head> ... <script type="text/javascript" src="mylib-min.js"></script> ... </head> <body> ... <script type="text/javascript" src="mylib-unclip.js"></script> <script type="text/javascript" src="mylib-domready.js"></script> </body> </html>
The preceding example assumes that the methods of the API will be called during page load. If this is not the case, then it is preferable to use this structure:
<html> <head> ... </head> <body> ... <script type="text/javascript" src="mylib-min.js"></script> <script type="text/javascript" src="mylib-unclip.js"></script> <script type="text/javascript" src="mylib-domready.js"></script> </body> </html>
Add-ons are downloaded seperately and extend the functionality of My Library. The files must be included after the main file.
This example shows the structure of a document that makes use of the Debug add-on:
<html> <head> ... <script type="text/javascript" src="mylib-min.js"></script> <script type="text/javascript" src="mylib-debug.js"></script> ... </head> <body> ... <script type="text/javascript" src="mylib-unclip.js"></script> <script type="text/javascript" src="mylib-domready.js"></script> </body> </html>
This example assumes that methods of the Debug add-on will be required during page load.
The Debug add-on adds several methods to the API to facilitate trouble-shooting applications.
The Scrolling Anchors add-on is a simple example that demonstrates the Scrolling Effects combination module.
The API is simply a collection of functions. The functions are encapsulated as methods of a global API object to prevent namespace collisions with other scripts. For reasons of performance, the structure of the API object is largely flat. See the object reference for more information.
The optional object wrappers adds several global factory functions that provide an OOP interface for My Library and enable the chaining of API methods. See the object reference for more information.
Calling applications should always detect methods of the API as the interface adapts to its environment.
Immediate methods may be feature detected and called during page load.
Deferred methods may not be feature detected or called until the document is ready. See the attachDocumentReadyListener function for more information