Skip to content

Instantly share code, notes, and snippets.

@anthonycole
Last active December 31, 2015 02:39
Show Gist options
  • Save anthonycole/7922084 to your computer and use it in GitHub Desktop.
Save anthonycole/7922084 to your computer and use it in GitHub Desktop.
Playing with Backbone routes - navigate to a specified main anchor
var GalleryRouter = Backbone.Router.extend ({
routes: {
'*actions': function(action) {
id = '#' + action;
jQuery(document).ready(function($) {
$("html, body").animate({ scrollTop: $(id).offset().top -150 }, 1000);
});
}
}
});
var appRouter = new GalleryRouter();
Backbone.history.start({pushState: true, root: "/mm+m/"});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment