詳解easyui 切換主題皮膚
jquery cookie下載地址::http://plugins.jquery.com/cookie/
1.需要導(dǎo)入的文件(我這里的easyui是jquery-easyui-1.6.11版本)
主要實(shí)現(xiàn)原理就是換導(dǎo)入css文件,這樣就可以實(shí)現(xiàn)切換主題皮膚
<!-- 引入easyui css樣式 只需引入easyui.css 其中就包含了其他的內(nèi)容--> <link rel="stylesheet" id="easyuiTheme" href="<%=request.getContextPath()%>/jquery-easyui-1.6.11/themes/default/easyui.css" rel="external nofollow" > <!-- 引入小圖標(biāo) --> <link rel="stylesheet" href="<%=request.getContextPath()%>/jquery-easyui-1.6.11/themes/icon.css" rel="external nofollow" > <!-- 引入jQuery --> <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.11.3.js"></script> <script src="js/jquery.cookie.js"></script> <!-- 引入easyui --> <script src="<%=request.getContextPath()%>/jquery-easyui-1.6.11/jquery.easyui.min.js" ></script> <!-- 樣式轉(zhuǎn)化為中文 --> <script src="<%=request.getContextPath()%>/jquery-easyui-1.6.11/locale/easyui-lang-zh_CN.js"></script>
2.前臺(tái)頁(yè)面定義了一個(gè)按鈕(代碼)
<div style="position: absolute;right: 14px;top:42px;">
<div style="padding:5px;">
<a href="javascript:void(0);" rel="external nofollow" class="easyui-menubutton" data-options="menu:'#layout_north_pfMenu',iconCls:'icon-ok'">更換皮膚</a>
</div>
</div>
<div id="layout_north_pfMenu" style=" display: none;">
<div "changeTheme('default');">default</div>
<div "changeTheme('black');">black</div>
<div "changeTheme('bootstrap');">bootstrap</div>
<div "changeTheme('gray');">gray</div>
<div "changeTheme('metro');">metro</div>
</div>
3.前臺(tái)效果圖

4.< script>里邊寫(xiě)了這個(gè)方法:changeTheme
/**
* 更換EasyUI主題的方法
* @param themeName
* 主題名稱
*/
changeTheme = function(themeName) {
var $easyuiTheme = $('#easyuiTheme');
var url = $easyuiTheme.attr('href');
var href = url.substring(0, url.indexOf('themes')) + 'themes/' + themeName + '/easyui.css';
$easyuiTheme.attr('href', href);
var $iframe = $('iframe');
if ($iframe.length > 0) {
for ( var i = 0; i < $iframe.length; i++) {
var ifr = $iframe[i];
$(ifr).contents().find('#easyuiTheme').attr('href', href);
}
}
$.cookie('easyuiThemeName', themeName, {
expires : 7
});
};
5.效果

切換之后效果,我就不一一展示效果了

以上所述是小編給大家介紹的easyui 切換主題皮膚方法詳解整合,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
- 為JQuery EasyUI 表單組件增加焦點(diǎn)切換功能的方法
- Jquery組件easyUi實(shí)現(xiàn)選項(xiàng)卡切換示例
- jquery-easyui關(guān)閉tab自動(dòng)切換到前一個(gè)tab
- 詳解EasyUi控件中的Datagrid
- EasyUI的DataGrid每行數(shù)據(jù)添加操作按鈕的實(shí)現(xiàn)代碼
- EasyUI在Panel上動(dòng)態(tài)添加LinkButton按鈕
- Easyui和zTree兩種方式分別實(shí)現(xiàn)樹(shù)形下拉框
- easyui datagrid 表格中操作欄 按鈕圖標(biāo)不顯示的解決方法
相關(guān)文章
分享一些常用的jQuery動(dòng)畫(huà)事件和動(dòng)畫(huà)函數(shù)
在jquery中,jquery動(dòng)畫(huà)事件和動(dòng)畫(huà)函數(shù)經(jīng)常用的到,今天小編抽時(shí)間給大家整理了些關(guān)于常用的jquery動(dòng)畫(huà)事件和動(dòng)畫(huà)函數(shù),對(duì)jquery動(dòng)畫(huà)函數(shù)和動(dòng)畫(huà)事件相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧2015-11-11
PHP+jquery+ajax實(shí)現(xiàn)分頁(yè)
這篇文章主要為大家詳細(xì)介紹了PHPjquery+ajax實(shí)現(xiàn)分頁(yè)的代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-12-12
jQuery實(shí)現(xiàn)轉(zhuǎn)動(dòng)隨機(jī)數(shù)抽獎(jiǎng)效果的方法
這篇文章主要介紹了jQuery實(shí)現(xiàn)轉(zhuǎn)動(dòng)隨機(jī)數(shù)抽獎(jiǎng)效果的方法,涉及jQuery操作隨機(jī)數(shù)及頁(yè)面元素的相關(guān)技巧,需要的朋友可以參考下2015-05-05
jquery 1.3.2 IE8中的一點(diǎn)點(diǎn)的小問(wèn)題解決方法
最近的項(xiàng)目中開(kāi)始使用了新版本的jquery,就是1.3.2版,發(fā)現(xiàn)在這個(gè)在版本對(duì)就radio類型的input在IE8中的支持不太好2009-07-07
jquery 學(xué)習(xí)之二 屬性相關(guān)
jquery 學(xué)習(xí)之二 屬性相關(guān)資料,學(xué)習(xí)jquery的朋友可以參考下。2010-11-11
jquery實(shí)現(xiàn)metro效果示例代碼
metro效果想必大家并不陌生吧,下面為大家講解下在jquery中時(shí)如何實(shí)現(xiàn)的,新手朋友們可不要錯(cuò)過(guò)了2013-09-09
ASP.NET中使用后端代碼注冊(cè)腳本 生成JQUERY-EASYUI的界面錯(cuò)位的解決方法
上一篇解決了用了JQUERY-EASYUI時(shí) 后端注冊(cè)腳本重復(fù)執(zhí)行的問(wèn)題.今天又發(fā)現(xiàn),通過(guò)后端代碼 生成的界面有錯(cuò)位現(xiàn)象.2010-06-06
jQuery實(shí)現(xiàn)判斷控件是否顯示的方法
這篇文章主要介紹了jQuery實(shí)現(xiàn)判斷控件是否顯示的方法,涉及jQuery針對(duì)頁(yè)面元素屬性相關(guān)操作技巧,需要的朋友可以參考下2017-01-01

