A tiny library to help with "Interface Previews" while data is being loaded, similar to Facebook.
While user is waiting for data to be loaded, he is shown a preview of the interface with placeholders instead of real data. They improve user experience because users can use the time normally spent looking at a white screen or an AJAX spinner getting familiar with the layout of your app.
Read More: Non-blocking UI's with interface previews
Source Code: Github
<div id="container" data-loading="container">
</div>
<div id="container" data-loading="container">
<div data-loading="placeholder">
Wait for it...
</div>
</div>
<div id="container" data-loading="container">
<div data-loading="placeholder">
Wait for it...
</div>
<div data-loading="empty">
No new posts to show.
</div>
</div>
$('#container').hasLoaded();
This will have no effect if you appended elements to the container, but if there are no elements to show, this function will make "No new posts..." visible.
MIT Licensed.