If you're looking to store data, you have a few options such as using cookies or HTML5 Storage. Personally, I lean towards HTML5 Storage for its simplicity and efficiency.
For those interested in using cookies, there are resources available like https://github.com/carhartl/jquery-cookie or that can help you get started.
Let's take a look at a simple example using amplify:
First, store an object:
amplify.store( "yourObject", { foo: "bar" } );
Then, retrieve it:
var retrievedValue = amplify.store( "yourObject" );
Alternatively, if you prefer working with jquery cookies:
To set a cookie:
$.cookie('staticclose', 'visible');
$.cookie('sads', 'invisible');
To retrieve a cookie:
$.cookie('staticclose'); // returns "visible"
$.cookie('sads'); // returns "invisible"
Another method is using data attributes to achieve the same outcome. However, if your goal is to remember the state even after reloading the page, cookies may be a better choice.
Here's an example using data attributes:
$("#div1").data("currentState", "visible");
$("#div2").data("currentState", "invisible");
To access the stored data:
var div1 = $("#div1").data("currentState"); // will return "visible"
var div2 = $("#div2").data("currentState"); // will return "invisible"