Last active
December 31, 2015 02:39
-
-
Save anthonycole/7922084 to your computer and use it in GitHub Desktop.
Playing with Backbone routes - navigate to a specified main anchor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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