1

I just can't figure out this problem.

The circumstances:
Website (Wordpress with Genesis and Altitude-Pro theme) with 4 pages with anchor-sections on it.

The problem:
If a link got clicked it loads the url with the hash (.../#section1) but it is not on the correct position. After hitting enter in the URL it jumps to the correct position.

I think this is because of Images that are loaded and the site jumps to the location before that.

What I tried:
I used this code, but it doesn change anything:

    $( window ).load(function() { 
    alert("LOADED");
    hash = document.location.hash;
    alert(hash);
    if (hash !="") {
        setTimeout(function() {
            if (location.hash) {
                window.scrollTo(0, 0);
                window.location.href = hash;
            }
        }, 1);
    }
    else {
        return false;
    }
});

Here's the link to the Demosite -> DEMOSITE

d.jordan
  • 63
  • 7
  • http://demo.renzen-communications.ch/spross.com/garten-und-landschaftsbau/#gartenplanung-landschaftsplanung - does jump, after going to the page, landing on hach + scrolling a bit after, getting alert and scrolling to hash again. So, what was the desired behavior? If no hash presents - there is nowhere to scroll to. – scarto Jan 20 '16 at 10:17
  • Sorry to bother but this works now for some reason oO thanks for anybodys help ;) – d.jordan Jan 20 '16 at 10:23

0 Answers0