Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBappy Golder
13,449 PointsHow can I get my slide to change only when the page is refreshed?
I want to create an effect in my program where the slider will only changes when the browser is refreshed/reloaded. How can I achieve that?
I'm working on a test project. It is going to be a list of quotes. And the page will have a new quote each time the browser is reloaded. It's not complete but here's the Git repo if you want to take a look:
1 Answer
Steven Parker
231,275 PointsYou might save the "last time loaded" locally.
Then, if the page is loaded again within a certain time frame, you could display the control differently.
Storing data between page loads is a typical use of a cookie, or of session storage. Session storage is a variant of local storage, which is covered in this short workshop: Using Local Storage with JavaScript.
Bappy Golder
13,449 PointsBappy Golder
13,449 PointsThanks Steven.