Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johansatge/jquery-notready
A lightweight script that allows you to make use of jQuery(document).ready before jQuery loads.
https://github.com/johansatge/jquery-notready
javascript jquery
Last synced: 17 days ago
JSON representation
A lightweight script that allows you to make use of jQuery(document).ready before jQuery loads.
- Host: GitHub
- URL: https://github.com/johansatge/jquery-notready
- Owner: johansatge
- License: mit
- Created: 2014-03-24T20:58:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-17T12:07:20.000Z (about 9 years ago)
- Last Synced: 2024-10-11T10:37:12.943Z (about 1 month ago)
- Topics: javascript, jquery
- Language: JavaScript
- Homepage:
- Size: 242 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jQuery notReady
A lightweight script that allows you to make use of `jQuery(document).ready` before jQuery loads.
---
* [Why](#why)
* [Installation](#installation)
* [Usage](#usage)
* [Changelog](#changelog)
* [License](#license)## Why
Let's consider that your webpage needs to call jQuery stuff when the DOM is ready, by using this common syntax:
```html
jQuery(document).ready(function($)
{
$('.my-div').jQueryStuff();
});```
This code needs jQuery to be loaded first. This is a problem as JS files should be loaded at the bottom of the page.
The `jquery.notready` script solves it by declaring a fake jQuery object that you can use everywhere on the page, and that will be replaced by the real one when it is propery loaded.
*Using jQuery calls in the HTML documents may not be a good thing, but in some cases it has to be done this way - this tool provides a workaround for those specific cases.*
## Installation
```bash
bower install jquery.notready
```Alternatively, you may manually install the `jquery.notready.min.js` and `jquery.ready.min.js` scripts wherever you want in your project.
Then, call the first script in ``:
```html
```
And the second one next to the jQuery call, at the bottom of the page:
```html