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';
        }
});
有帮助吗?

解决方案 2

I solved it, this is my solution:

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

Thanks for your help!

其他提示

it should be like

if(hash == ''){
    hash = '#home';
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top