Skip to content

Instantly share code, notes, and snippets.

@rom3r4
Created April 4, 2014 02:30
Show Gist options
  • Select an option

  • Save rom3r4/9966974 to your computer and use it in GitHub Desktop.

Select an option

Save rom3r4/9966974 to your computer and use it in GitHub Desktop.
Backbone route
$(document).on("click", "a:not([data-bypass])", function(evt) {
var href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
var root = location.protocol + "//" + location.host + app.root;
if (href.prop && href.prop.slice(0, root.length) === root) {
evt.preventDefault();
Backbone.history.navigate(href.attr, true);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment