Saving multiple panel's collapsed state using cookies with $.cookie()

前端 未结 5 1152
野性不改
野性不改 2021-02-01 19:12

I\'m trying to determine how I might save a collapsible panel\'s collapsed state using $.cookie.

This question has been helpful so far, but still missing the end soluti

5条回答
  •  情书的邮戳
    2021-02-01 19:48

    I'd rather use localStorage than cookies.

    You just need to create a variable on local storage for each panel associated to it's id, where you store the state of the panel.

    When loading the page, just loop all panel classed objects checking it's associated variable in local storage and applying appropiate classes depending on the value.

提交回复
热议问题