Skip to content

Instantly share code, notes, and snippets.

@quirkey
Created October 29, 2010 06:17
Show Gist options
  • Save quirkey/653014 to your computer and use it in GitHub Desktop.
Save quirkey/653014 to your computer and use it in GitHub Desktop.
$.sammy(function() {
var h = "";
this.bind('run', function() {
$(window).bind('scroll', function() {
// find nearest `h` and set it to $h
h = $h.attr('id');
// redirect to the new location
this.redirect('#', 'area', h);
});
});
this.get('#/area/:h', function(ctx) {
// check h
if (h != this.params.h) {
// focus on $h
} else {
// do nothing
}
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment