learnxinyminutes-site
learnxinyminutes-site copied to clipboard
How about anchor navigation in code ?
I suggest something like:
$(function() {
if (location.hash.indexOf('code-') == 0) {
$(document).scrollTop($(location.hash).offset().top);
}
$(".highlight > span").each(function(i) {
this.id = "code-"+i;
}).click(function() {
location.hash = this.id;
});
});