Do you like Turbolinks? It's easy and fast way to improve user experience of surfing on your website.
But if you have a large codebase with lots of
I wrote jquery.turbolinks to solve this problem in my project. It's easy to use: just require it immediately after
jquery.js. Your other scripts should be loaded after
turbolinks.js should be after your other scripts.
Initially sponsored by Evil Martians.
This project is a member of the OSS Manifesto.
This readme points to the latest version (v2.x) of jQuery Turbolinks, which features new 2.0 API. For older versions, see v1.0.0rc2 README.
//= require jquery//= require jquery.turbolinks//= require jquery_ujs//// ... your other scripts here ...////= require turbolinks
And it just works!
Checkout "Faster page loads with Turbolinks" for deeper explanation how to use jQuery Turbolink in real world.
You can check if the page is ready by checking
$.turbo.isReady, which will be
false depending on whether the page is loading.
If you find that some events are being fired multiple times after using jQuery Turbolinks, you may have been binding your
document events inside a
$(function()) block. For instance, this example below can be a common occurrence and should be avoided:
/* BAD: don't bind 'document' events while inside $()! */;
You should be binding your events outside a
$(function()) block. This will ensure that your events will only ever be bound once.
/* Good: events are bound outside a $() wrapper. */
jQuery Turbolinks doesn't support ready events bound via
$(document).on('ready', function). Instead, use
// BAD: this will not work.;// OK: these two are guaranteed to work.;;
This project uses Semantic Versioning for release numbering.
For changelog notes, checkout releases page.