前端如何切换主题
1、在皮肤最顶层 做一个classname来标示如darklight..dark button { color: white; background: dark; }.light button { color: dark; background: gray; }
2、这种方式的好处在于, 不用加载额外css, 只需要改变顶层的classname就可以达到切换皮肤的效果
3、通过动态修改link<link href="theme.default.css" /><l足毂忍珩ink href="theme.dark.css" id="J-theme-link" />
4、theme.light.cssbutton { color: white; background: dark; }
5、theme.dark.cssbutton { color: dark; background: gray; }
6、js控制functio艘绒庳焰n changeTheme(type) { var el = doucment.querySelect泠贾高框or('J-theme-link'); el.href = themeUrl + '/theme.' + type + '.css'; }
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:31
阅读量:96
阅读量:27
阅读量:40
阅读量:81