Surf the Dream A discourse of links and articles from Justin Avery

jQuery Table of Contents

This is a heading

There are occasions when you want to be able to preview the headings that come further down the page, but you won’t want to have to maintain them every time the content might change. This is where this little snippet of jquery comes in handy. It takes all the H2 elements on the page and adds them to an unordered linked list, and appends the required anchor tags to the H2 elemetns.

This example is a little bit shit, because I haven’t omited the H2’s in for the related links. You know what though, I’m bloody busy right now and have other things to do…. so just make sure you target the right areas ;)

Below is the JSFIDDLE code to copy

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a 3rd heading

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

Antoher Level 2

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of difThis is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.fernent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a 3rd heading

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of diffThis is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.ernent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a 3rd heading

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

Surf the Dream is a blog that has been running since the mid 2000's when it started on BlogSpot. Over the years it's been rebranded as justinavery.me (now my resume) and JaveryDesign.com (which now redirects back to this site).

I offer consultation services through Simple Things, produce a range of educational pocket notebooks, write about the Universe and run a responsive design and a RWD Weekly Newsletter