浏览代码

Merge branch 'master' of gitee.com:yinqi/Light-Year-Admin-Template

笔下光年 6 年之前
父节点
当前提交
81eb0c78ee
共有 1 个文件被更改,包括 31 次插入0 次删除
  1. 31 0
      README.md

+ 31 - 0
README.md

@@ -3,6 +3,9 @@
 #### 演示网址
 #### 演示网址
 [http://lyear.itshubao.com](http://lyear.itshubao.com)
 [http://lyear.itshubao.com](http://lyear.itshubao.com)
 
 
+#### 交流群
+703726776
+
 #### 介绍
 #### 介绍
 ![light year admin](https://images.gitee.com/uploads/images/2019/0314/224956_3eb2a29a_82992.png "未命名-1.png")
 ![light year admin](https://images.gitee.com/uploads/images/2019/0314/224956_3eb2a29a_82992.png "未命名-1.png")
 
 
@@ -24,6 +27,34 @@
 
 
 主题切换并没有存到cookie中,大家根据自己实际情况,做cookie存储或者其他方式。
 主题切换并没有存到cookie中,大家根据自己实际情况,做cookie存储或者其他方式。
 
 
+#### jquery-cookie保存设置示例
+```
+	// 读取cookie中的主题设置
+	var the_logo_bg    = $.cookie('the_logo_bg'),
+	    the_header_bg  = $.cookie('the_header_bg'),
+	    the_sidebar_bg = $.cookie('the_sidebar_bg'),
+	    the_site_theme = $.cookie('the_site_theme');
+	console.log(the_logo_bg);
+	if (the_logo_bg) $('body').attr('data-logobg', the_logo_bg);
+	if (the_header_bg) $('body').attr('data-headerbg', the_header_bg);
+	if (the_sidebar_bg) $('body').attr('data-sidebarbg', the_sidebar_bg);
+	if (the_site_theme) $('body').attr('data-theme', the_site_theme);
+	
+	// 设置主题配色
+	setTheme = function(input_name, data_name) {
+	    $("input[name='"+input_name+"']").click(function(){
+	        $('body').attr(data_name, $(this).val());
+	        $.cookie('the_'+input_name, $(this).val());
+	    });
+	}
+	setTheme('site_theme', 'data-theme');
+	setTheme('logo_bg', 'data-logobg');
+	setTheme('header_bg', 'data-headerbg');
+	setTheme('sidebar_bg', 'data-sidebarbg');
+```
+> 由jquery读取设置,可能会受到加载速度的影响
+
+
 #### 特别感谢
 #### 特别感谢
 - Bootstrap(去掉了自带的字体图标)
 - Bootstrap(去掉了自带的字体图标)
 - JQuery
 - JQuery