亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

詳解easyui 切換主題皮膚

 更新時(shí)間:2019年04月04日 14:41:33   作者:不是吧!  
這篇文章主要介紹了easyui 切換主題皮膚方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

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)頁面定義了一個(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>里邊寫了這個(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ì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論