Question

I've been using SO for a few years now and it is a lifesaver! Love you all. But I've finally got a question that I don't see answered here yet and it's a significant "bells-and-whistles"-type feature I want on my business's site. Maybe you can help!

Basically, I want the script to check the url of the previous page; if the previous page was outside of my site, I want the whole body to fadeIn (or a similar effect, I haven't decided for sure); if the previous page was from within my site, I only want 2 or 3 elements to fadeIn (header, nav, etc.), as I will be using AJAX & PHP to dynamically change the content.

For example: on my home page, the nav is located in the main content area. When a user navigates to a different page on the site, the nav is moved to the header area. Naturally, if the layout doesn't change, no animation is needed BUT I want to make sure that there's no need for the whole body to fade in between each page.

I hope I've made this clear enough. If you have any questions, ask away! Thank you!

Était-ce utile?

La solution

You're using PHP too, leverage that, use PHP to check your referrer, if its the same host have it drop a "1" into a var prevPage = ; in a script tag, if its not drop a 0, then just look for that 1 or 0 to determine visibility.

Personally though...

If I went to a site that fades in, I'd leave immediately. This isn't 1999 anymore, that kind of stuff is annoying and hinders user experience, its not a "bells and whistles" its just strictly annoying.

Now if you want to fade out the content pane while you ajax the new content when they click a link and fade in the new content when it comes back with ajax, that's fine, the time it takes to do that will probably be no greater than if they clicked to leave the page, but loading a blank site then fading it in, first thing I'd click is the back button and go someplace else.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top