jQuery Easyui使用(二)之可摺疊面板動態載入無效果的解決方案,jqueryeasyui

來源:互聯網
上載者:User

jQuery Easyui使用(二)之可摺疊面板動態載入無效果的解決方案,jqueryeasyui

在上篇文章給大家介紹了jQuery Easyui使用(一)之可摺疊面板的布局手風琴菜單

先上代碼:

<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>用車管理</title><link href="../JQuery/easyui/themes/icon.css" rel="stylesheet" /><link href="../JQuery/easyui/themes/default/easyui.css" rel="stylesheet" /><script src="../JQuery/jquery.min.js"></script><script src="../JQuery/easyui/jquery.easyui.min.js"></script><script src="../JQuery/easyui/locale/easyui-lang-zh_CN.js"></script><style>#div_left {width: 250px;background-color: powderblue;font-size: inherit;}#div_welcome {margin: 15px 0 15px 0;text-align: center;}#div_leftmenu div {font-size: 15px;}#div_leftmenu div ul {margin: 15px 15px 15px 15px;padding: 0;overflow: hidden;line-height: 40px;max-height: 200px;}#div_leftmenu div ul li {list-style-type: none;background-color: #DFE2E3;text-align: center;margin-bottom: 15px;}#div_leftmenu div ul li:hover{list-style-type: none;background-color: powderblue;text-align: center;margin-bottom: 15px;cursor:pointer;}#div_leftmenu div ul li:last-of-type {margin-bottom: 0;}</style></head><body class="easyui-layout" style="font-size: 15px;" data-options="fit:true"><form id="form1" runat="server"><!--左側--><div id="div_left" data-options="region:'west',title:' '"><div id="div_welcome">admin,歡迎您</div><div id="div_leftmenu" class="easyui-accordion"></div></div><!--右側--><div data-options="region:'center',title:' '" style="padding: 5px;"></div></form><script type="text/javascript">var usertype = "0";$(document).ready(function () {var div_leftmenu_html = '';switch (usertype) {case "0"://車輛管理員div_leftmenu_html += '<div title="車輛登記">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>車輛登記</li>';div_leftmenu_html += ' <li>添加</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="用車指派">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>用車指派</li>';div_leftmenu_html += ' <li>指派</li>';div_leftmenu_html += ' <li>詳情</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="審核人管理">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>審核人管理</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';break;case "1"://學校領導div_leftmenu_html += '<div title="用車審批">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>用車審批</li>';div_leftmenu_html += ' <li>審批</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="用車申請">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>用車申請</li>';div_leftmenu_html += ' <li>申請</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="通知">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>通知</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';break;case "2"://司機div_leftmenu_html += '<div title="司機確認">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>司機確認</li>';div_leftmenu_html += ' <li>確認</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';break;case "3"://普通教師div_leftmenu_html += '<div title="用車申請">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>用車申請</li>';div_leftmenu_html += ' <li>申請</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="通知">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>通知</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';break;default:break;}$("#div_leftmenu").html(div_leftmenu_html);});</script></body></html>

結果:

接下來不斷嘗試

一:usertype = "1";

二:usertype = "2";

三:usertype = "3";

四:

//導覽功能表綁定初始化$(".easyui-accordion").accordion();

結果:沒效果

五:修改後的代碼如下

<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>用車管理</title><link href="../JQuery/easyui/themes/icon.css" rel="stylesheet" /><link href="../JQuery/easyui/themes/default/easyui.css" rel="stylesheet" /><script src="../JQuery/jquery.min.js"></script><script src="../JQuery/easyui/jquery.easyui.min.js"></script><script src="../JQuery/easyui/locale/easyui-lang-zh_CN.js"></script><style>#div_left {width: 250px;background-color: powderblue;font-size: inherit;}#div_welcome {margin: 15px 0 15px 0;text-align: center;}#div_leftmenu div {font-size: 15px;}#div_leftmenu div ul {margin: 15px 15px 15px 15px;padding: 0;overflow: hidden;line-height: 40px;max-height: 200px;}#div_leftmenu div ul li {list-style-type: none;background-color: #DFE2E3;text-align: center;margin-bottom: 15px;}#div_leftmenu div ul li:hover{list-style-type: none;background-color: powderblue;text-align: center;margin-bottom: 15px;cursor:pointer;}#div_leftmenu div ul li:last-of-type {margin-bottom: 0;}</style></head><body class="easyui-layout" style="font-size: 15px;" data-options="fit:true"><form id="form1" runat="server"><!--左側--><div id="div_left" data-options="region:'west',title:' '"><div id="div_welcome">車輛管理員1,歡迎您</div></div><!--右側--><div data-options="region:'center',title:' '" style="padding: 5px;"></div></form><script type="text/javascript">var usertype = "0";$(document).ready(function () {var div_leftmenu_html = '<div id="div_leftmenu" class="easyui-accordion">';//switch (usertype) {case "0"://車輛管理員div_leftmenu_html += '<div title="車輛登記">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>車輛登記</li>';div_leftmenu_html += ' <li>添加</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="用車指派">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>用車指派</li>';div_leftmenu_html += ' <li>指派</li>';div_leftmenu_html += ' <li>詳情</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="審核人管理">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>審核人管理</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';break;case "1"://學校領導div_leftmenu_html += '<div title="用車審批">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>用車審批</li>';div_leftmenu_html += ' <li>審批</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="用車申請">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>用車申請</li>';div_leftmenu_html += ' <li>申請</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="通知">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>通知</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';break;case "2"://司機div_leftmenu_html += '<div title="司機確認">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>司機確認</li>';div_leftmenu_html += ' <li>確認</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';break;case "3"://普通教師div_leftmenu_html += '<div title="用車申請">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>用車申請</li>';div_leftmenu_html += ' <li>申請</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';div_leftmenu_html += '<div title="通知">';div_leftmenu_html += ' <ul>';div_leftmenu_html += ' <li>通知</li>';div_leftmenu_html += ' </ul>';div_leftmenu_html += '</div>';break;default:break;}div_leftmenu_html += '</div>';$("#div_left").append(div_leftmenu_html);//導覽功能表綁定初始化$(".easyui-accordion").accordion();});</script></body></html> 

結果:

手風琴載入出來了。

以上所述是小編給大家介紹的jQuery Easyui使用(二)之可摺疊面板動態載入無效果的解決方案,希望對大家有所協助,如果大家有任何疑問請給我留言,小編會及時回複大家的。在此也非常感謝大家對幫客之家網站的支援!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.