0

I'd like to be able to trigger animations based on the websites requested url. So for example www.site.com/index.php#houses

Then that would make a <div id="houses"> fade in?

Is there a simple way to do this?

2 Answers 2

4

You could try this:

$(function(){
    $(window.location.hash).fadeIn();
});
Sign up to request clarification or add additional context in comments.

1 Comment

the window.location.hash already contains a #, so it needs to be removed before using it $("#"+window.location.hash.substr(1)).fadeIn();
1

try this:

function(){
    var uri = window.location.pathname;
    if(uri.indexOf("#houses") > 0){
        $("#houses").fadeIn();
    }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.