save split size change after refresh
MorDery opened this issue · 2 comments
MorDery commented
I use split pane to split the screen to two part and I initial the size to 20%.
I need that if I change the size and refresh the page the size stay on the new size and don't return to 20% again.
can you help me to do that?
RahafJ96 commented
-
You can use the
localStorage (HTML5 browsers only)
- you could save it as a property of the page's local storage allowance -
Save it in a cookie
// Set a cookie or 2
document.cookie = 'somevar=somevalue';
document.cookie = 'another=123';
function getCookie(name)
{
// Cookies seperated by ; Key->value seperated by =
for(var i = 0; pair = document.cookie.split("; ")[i].split("="); i++)
if(pair[0] == name)
return unescape(pair[1]);
// A cookie with the requested name does not exist
return null;
}
// To get the value
alert(getCookie('somevar'));
- Append the variable to the URL hash so it's retrievable via
location.hash
after the refresh
MorDery commented
can you tell me what is the hoke I need to catch to save the change?