Skip to content

Instantly share code, notes, and snippets.

@JacksonGariety
Created January 16, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JacksonGariety/05004b669cfd699c2c2b to your computer and use it in GitHub Desktop.
Save JacksonGariety/05004b669cfd699c2c2b to your computer and use it in GitHub Desktop.
kill link click-throughs for Backbone
// Kill link click-throughs
$(document).on('click', 'a:not([data-bypass])', function (event) {
if (history.pushState && this.host === window.location.host) {
event.preventDefault()
event.stopPropagation()
App.getInstance().router.navigate(this.pathname, true)
$.reset(this)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment