I believe that this is a code that is used for dynamic scrolling of internal links on a page. When clicking on a link the page should slide down or go up to the appropriate position on the page. I have some experience in Jquery and Javascript but I have never seen something like 'a[href*=#]'. Most of all I would like to know what should the HTML for this code looks like so that it works. I haven't been able to run it so far. $('a[href*=#]').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[id=' + this.hash.slice(1) + ']'); if ($target.length) { var targetOffset = $target.offset().top; $('html,body').animate({scrollTop: targetOffset}, 1000); return false; } } });
what it does is it scrolls-up the page slowly, not like when you click on an anchor that jumps top the top.. a[href*=#] means it will look for anchor tags with href value of # just like this.. <a href="#" title="Go to Top of the Page">Go to Top of the Page</a> HTML:
thanks for replaying even though I have figured it out by now it would have been nice if there was a way of marking a thread as solved once you've got the answer