Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

save split size change after refresh #805

Open
MorDery opened this issue Nov 21, 2021 · 2 comments
Open

save split size change after refresh #805

MorDery opened this issue Nov 21, 2021 · 2 comments

Comments

@MorDery
Copy link

MorDery commented Nov 21, 2021

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
Copy link

  1. You can use the localStorage (HTML5 browsers only) - you could save it as a property of the page's local storage allowance

  2. 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'));
  1. Append the variable to the URL hash so it's retrievable via location.hash after the refresh

source

@MorDery
Copy link
Author

MorDery commented Nov 28, 2021

can you tell me what is the hoke I need to catch to save the change?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants