Defer Load jQuery Plugin
jQuery plugin developed by enavu to enrich the event of clicking on a link that opens new page.
This plug-in enriches the effect when you click on a link. Instead of instantly opening in a new window it adds a little loader graphic for the desired amount of seconds and than opens the page in a [...]
jQuery plugin developed by enavu to enrich the event of clicking on a link that opens new page.
This plug-in enriches the effect when you click on a link. Instead of instantly opening in a new window it adds a little loader graphic for the desired amount of seconds and than opens the page in a new window. This allows for the user to notice that he has requested a new page that will open momentarily, it also makes the user feel like the new page has been pre-loaded.
How to use
All you need to do is implement this line:
$("a.deferLoadCLass").deferLoad();
//you can also add the following options
$("a.deferLoadCLass").deferLoad({wait:"3000",image:"images/loading.gif",attr:"href"});
We use the wait to choose how long the loading gif will appear for before the new page comes up. The image is the location of your loading gif. And the attr allows you to choose a custom attribute for where the link comes from.
Download Plugin
or view demo
Demo
update: we have fixed a small issue with chrome (the new window was marked as pop-up)
Related posts:
- Daily Tip : Difference between $(document).ready and $(window).load in jQuery
- How To Create a jQuery Plugin
- Advanced jQuery Placeholder Plugin (cross-browser support)
- jPaginate – jQuery Pagination System Plugin
- How to make a completely reusable jquery modal window
Did you absolutely LOVE this article... share it!
Comments
- works in FF
- Chrome (Mac) not working (at least here). instantly opens new window.
suggestion: perhaps adding an option to the function for using new window (window.open) or same window (location.href)
good job
You are correct as i stated above it unfortunately does not wait in Chrome, that’s because when it waits in chrome it marks it as a pop-up and blocks it. I am working on fixing that issue, and i will definitely integrate the same window touch to the plugin.
Thanks!
don’t work in safari 5
Leave your own!