Page reload; js animation help
- Started
- Last post
- 5 Responses
- Complexfruit
I'm working on a simple site where on the homepage I'd like it to play a short javascript animation when you visit the page. Ultimately there will be 3 different animations. On a page reload, I'd like it to play 1 of the 3 animations. Is there a tutorial out there that could help me achieve this? I'm just not sure how to do it and I'm trying to figure it out.
Desired functionality:
1. Visitor arrives on page
2. Animation 1 plays
3. Visitor reloads/revisits page
4. Animation 2 plays
5. Visitor reloads/revists page again
6. Animation 3 plays
etc.
- ukit20
Set a cookie?
- Nathan_Adams0
If you didn't want to use cookies, you could probably use html5 localstorage. Use js to set a variable at the end of each animation, save it to localstorage, and then check what the variable is on page load.
- Thanks man, I'm not familiar with this approach and will research it further. I really appreciate the tip.Complexfruit
- Thanks man, I'm not familiar with this approach and will research it further. I really appreciate the tip.Complexfruit
- Stugoo0
A cookie is your best cross browser option.
- ********0
it's just a random function, the function implementation depends on many things: markup, Js etc..
- azimuth********
- i know i know,but you , specialy YOU: fuck OFF.********
- azimuth
- dbloc0
cook a settie.