I'm using anchors on my website with several div
s.
When my page loads, I have a #
at the end of my URL like this:
http://www.website.com/projects#third
I also have a fixed header, with 100px height.
I'm using scrollto plugin.
What I'm trying to do is that when my pages loads it scrolls to the #div
of the URL, and with the offset of the header height.
Here is what I tried using jQuery, but it's not working.
$(window).load(function() {
var hashVal = window.location.hash;
var headerheight = $("header").height();
$('body').scrollTo(hashVal, { duration: 'slow', offsetTop: headerheight});
});
Can't figure out what I am doing wrong.