certainlyakey
6/23/2014 - 1:41 PM

Automatically create drop-down menu with links to the list items at the beginning of long lists

Automatically create drop-down menu with links to the list items at the beginning of long lists

$('#publications').prev(':header').css('float','left');
$('#publications').before('<select id="toc" class="jumpmenu"></select>');
$("#publications li strong").each(function(i) {
    $(this).attr("id", i+1);
    $("#toc").append("<option value='#"+(i+1)+"'>"+$(this).text()+"</option>");
});
$(".jumpmenu").change(function() {
   		window.location.href = $(this).val();
});