This repository has been archived by the owner. It is now read-only.
Browse files

Merge branch 'patch-3' of

… into rstacruz-patch-3

  • Loading branch information...
2 parents ec0cdff + 008aba4 commit ef267e744771c32774e93cbb1f45da5526bcfb64 @kossnocorp committed Feb 1, 2013
Showing with 21 additions and 1 deletion.
  1. +21 −1
@@ -6,7 +6,7 @@ But if you have a large codebase with lots of `$(el).bind(...)` Turbolinks will
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 `jquery.turbolinks.js`, and `turbolinks.js` should be after your other scripts.
-Sponsored by [Evil Martians](
+Initially sponsored by [Evil Martians](
This project is a member of the [OSS Manifesto](
@@ -46,6 +46,26 @@ If you want to change default behaviour you can use `$.setFetchEvent`:
+## Troubleshooting
+### Events firing twice or more
+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:
+``` javascript
+/* BAD: don't bind 'document' events while inside $()! */
+$(function() {
+ $(document).on('click', 'button', function() { ... })
+You should be binding your events outside a `$(function())` block. This will ensure that your events will only ever be bound once.
+``` javascript
+/* Good: events are bound outside a $() wrapper. */
+$(document).on('click', 'button', function() { ... })
## Changelog
This project uses [Semantic Versioning]( for release numbering.

0 comments on commit ef267e7

Please sign in to comment.