javascript - Use localstorage to remember dark mode preference
问题描述
I'm working on a website for myself, a search engine. My intention is to make it a nice and fast search engine. Now I like the website and have added dark mode. You can turn it on and off with the green button. Now I am a total novice in javascript and I know literally nothing about it. How can I make localstorage remember whether you have turned on light or dark theme?
This is the project: https://glitch.com/edit/#!/mozobrowser?path=index.html%3A1%3A0 and this is the website: https://mozobrowser.glitch.me/
I would really appreciate if someone would help me.
解决方案
推荐阅读
- python - 什么是 jinja2 相当于 django 添加过滤器?
- jboss - 具有管理员权限的用户无法在 jbpm 中声明或完成其他用户的任务
- php - 如何从 2D 数组中的查询构建器中获取理论实体?
- c++ - 无法在动态链接库 C:\myexe.exe 中找到过程入口点 CryptAcquireContextA
- objective-c - 弃用 Swift 库的 Objective-C 接口
- angular - 无法绑定到“ngStyle”,因为在导入 CommonModule 时它不是“div”的已知属性
- r - 按组创建具有特定周值的列
- python - Django,如何按日期对模型进行分组?
- java - java - 如何使用导致大内存的java替换非常大的字符串中的字符?
- python - 纸浆.solvers.PulpSolverError:纸浆:无法执行cplex