adambard / adambard/learnxinyminutes-site

How about anchor navigation in code ?

Open
#28 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
57
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I suggest something like:

``` javascript
$(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;
});
});
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.