Internal Links in my Code Bits


#1

Right now I am working on a code bit, and I have a able of contents. I want people to easily get from the table of contents to a section that they want to go to. I was wondering if there was anyway to do this with internal links?


#2

@williamwallacef13 Give each section an id, then link to the id. For example:

<a href="#about">

<!-- ... -->

<h1 id="about">About Me</h1>
<p>...</p>

:slight_smile:


#3

I tried that, but all the link did when I clicked it was flash. Here is the code bit: https://www.codecademy.com/WilliamWallaceF13/codebits/I2HJQj/edit


#4

Hm, seems like the Codebit is interfering with default browser behavior there :confused:

If you use JS to do the scrolling, you get a smooth scroll, and it works in a Codebit, so you could try that :slight_smile:

https://www.codecademy.com/zystvan/codebits/4tiXm4/edit


Code Bits interfering with Internal Links
#5

Thx a lot :slight_smile: I will do just that.


#6

Should I report it as a bug?


#7

Up to you. It doesn't look like Codebits are being maintained anymore to me, but there's a chance it will get fixed if you report it ¯\_(ツ)_/¯