Getting Started
To use oLoader, include the script in your project:
<script src="./oloader.js"></script>
Basic Usage
Initialize oLoader and load content dynamically:
const loader = oLoader();
loader.body('./content.html').load();
Another way to load content conditionally:
const app = oLoader();
app.body('index.html', 'b');
if (true) {
console.log("Condition met, content will load");
app.load();
}
Using beforeLoad
The beforeLoad
method allows you to execute code before content is loaded.
loader.beforeLoad(() => {
console.log("Loading content...");
}).body('./content.html').load();