Search code examples
jqueryhashchange

Nothing is loaded when the hash is empty with hashchange


I have a question about the jquery.hashchange.js.

I get everything to work, my only problem is when there is no hash. When you first go to the page, it just is: domain.com/

But it should act like: domain.com/#home

I tried this, but it wont work:

$(window).hashchange( function(){
        var hash = location.hash;

        if(hash = ''){
            hash == '#home';
        }
});

Solution

  • I solved it, this is my solution:

    if(hash == '#home' || hash == ""){
    

    Thanks for your help!