Created
October 29, 2010 06:17
-
-
Save quirkey/653014 to your computer and use it in GitHub Desktop.
This file contains 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
$.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