Jquery scroll to animation - distance from top ie issue.
I've got a scrolling effect working for some on-page anchors, and though this works in most modern browsers, in internet explorer 8 and below there is a small problem.
You see, there's a fixed header which was hiding the top of each anchor after being clicked, so I set the scroll to move down an extra 140 pixels, and this works a treat. It even works in ie8 and below, except after moving into position, the 140 pixel margin then reverses and the content then moves below the header.
Here's the jquery code:
And the links:
var target = $(this).attr("href");
var target = location.hash;
scrollTop: $(target).offset().top -140
location.hash = target;
The purpose of the second half of the jquery is to enable the scrolling effect after clicking through to one of the anchors from another page.
Any help would be massively appreciated. Here's the page itself if that is of any use: http://bit.ly/No0aaV - and it's the About Us drop menu links that this issue relates to.