+ // update current judge on scroll
+ $(window).scroll(function() {
+ $("#menu ol li a").each(function(){
+ // if the relevant link appearsmore than half way down the page
+ var $anchor = $('a[name="'+$(this).attr("href").slice(1)+'"]');
+ if ($(window).scrollTop() + $(window).height()/2 > $anchor.offset().top) {
+ austlii.$currentSection = $(this);
+ }
+ });
+ $("#menu ol li a").not(austlii.$currentSection).removeClass("current");
+ austlii.$currentSection.addClass("current");
+ }); $(window).scroll(); // and run it once