2 function scrollToAnchor(anchor) {
4 var name = anchor.slice(1);
5 $.scrollTo('a[name="' + name + '"]', 500, {offset: {top: -50, left: 0}});
6 $('a[name="' + name + '"]').highlightFade('yellow');
7 window.location.hash = '#' + name;
11 $.highlightFade.defaults.speed = 3000;
13 if ($('#toc li').length == 0) {
14 $('#menu li a[href="#toc"]').remove();
17 // On page load, scroll to anchor
18 scrollToAnchor(window.location.hash)
20 $('body').delegate('click', '#toc a, #themes a, .anchor, .annotation', function(event) {
21 event.preventDefault();
22 $('#menu li a.selected').click();
23 scrollToAnchor($(this).attr('href'));
26 $('#menu li a').toggle(function() {
27 $('#menu li a.selected').click();
28 $(this).addClass('selected');
29 $($(this).attr('href')).slideDown('fast');
31 $(this).removeClass('selected');
32 $($(this).attr('href')).slideUp('fast');