Difference between revisions of "Template:ETH Zurich"
m |
m |
||
Line 113: | Line 113: | ||
var windowPos = $(window).scrollTop(); | var windowPos = $(window).scrollTop(); | ||
− | $('# | + | $('#sidemenu li a[href^="#"]').each(function() { |
var currentLink = $(this); | var currentLink = $(this); | ||
Line 119: | Line 119: | ||
{ | { | ||
var refElement = $(currentLink.attr("href")); | var refElement = $(currentLink.attr("href")); | ||
− | if (refElement.position().top <= windowPos && (refElement.position().top + refElement.height() + $("# | + | if (refElement.position().top <= windowPos && (refElement.position().top + refElement.height() + $("#sidemenu").height() ) > windowPos) { |
− | $('# | + | $('#sidemenu li a').removeClass("current"); |
currentLink.addClass("current"); | currentLink.addClass("current"); | ||
} | } |
Revision as of 17:53, 19 August 2015