toc = $("ul#toc"); $("#content").find("h2").each(function() { h = $(this); toc.append("
  • " + h.text() + "
  • "); }); $('#nav').affix({ offset: $('#nav').position() });