如何停止页面加载为“黑暗模式”设置为白色
我有一个脚本,该脚本读取cookie和Load主题(夜间或光线)模式
$(document).ready(function () {
var themeCookiesName = getCookie('Theme');
if (themeCookiesName == 'dark') {
document.body.classList.toggle("dark-theme")
}
else {
document.body.classList.toggle("light-theme")
}
})
时,将其设置为黑暗,页面在加载深色模式之前会闪烁白色。 有什么想法吗?
I have a script that reads the cookie and load theme according(night or light) mode
$(document).ready(function () {
var themeCookiesName = getCookie('Theme');
if (themeCookiesName == 'dark') {
document.body.classList.toggle("dark-theme")
}
else {
document.body.classList.toggle("light-theme")
}
})
When it set to dark them, the page flashes white before it load the dark mode them.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)