Show a "please wait.. loading"-gif when link to anchor is clicked

Show a "please wait.. loading"-gif when link to anchor is clicked

Hi Coders!

i'm new to using jquery, but i use this code for scrolling to anchors when anchor-links are clicked :
-----------
$(document).ready(function($) {


$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if ($) {
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 2050);
return false;
}
}
}
});
});
----

And it works like a charm, but i have a "one page"-site with maaaany anchor-points and when it scrolls from, lets say top to bottom, it's scrolling like the browser is on speed :p

So i was wondering if you guys know how i could display a loading-gif or some text in a overlay-div when there is more than, lets say 1000px between the anchorpoint where browser window is to another anchor point?

sorry for my bad english and my explaining-skillz, but i hope you understand what i mean..

/Cheers