L
L
Localhost2017-04-08 12:44:25
HTTP Cookies
Localhost, 2017-04-08 12:44:25

How to remember js function for user?

Hello, there is a toggle function that responds to screen size.
What could be the solution for remembering this function for the user. I clicked to change the screen, it changed, and js remembered this for all pages, for this user.

$(document).ready(function(){
  $(".button").click(function(){
    $("body").toggleClass("boxed"); return false;
  });
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-04-08
@selo

Use a cookie or localstorage in js to store the information you need and check for the required value when the page loads.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question