basic.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Basic SideMenu - jQuery EasyUI Demo</title>
  6. <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="../demo.css">
  9. <script type="text/javascript" src="../../jquery.min.js"></script>
  10. <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
  11. <script type="text/javascript">
  12. var data = [{
  13. text: 'Item1',
  14. iconCls: 'icon-sum',
  15. state: 'open',
  16. children: [{
  17. text: 'Option1'
  18. },{
  19. text: 'Option2'
  20. },{
  21. text: 'Option3',
  22. children: [{
  23. text: 'Option31'
  24. },{
  25. text: 'Option32'
  26. }]
  27. }]
  28. },{
  29. text: 'Item2',
  30. iconCls: 'icon-more',
  31. children: [{
  32. text: 'Option4'
  33. },{
  34. text: 'Option5'
  35. },{
  36. text: 'Option6'
  37. }]
  38. }];
  39. function toggle(){
  40. var opts = $('#sm').sidemenu('options');
  41. $('#sm').sidemenu(opts.collapsed ? 'expand' : 'collapse');
  42. opts = $('#sm').sidemenu('options');
  43. $('#sm').sidemenu('resize', {
  44. width: opts.collapsed ? 60 : 200
  45. })
  46. }
  47. </script>
  48. </head>
  49. <body>
  50. <h2>Basic SideMenu</h2>
  51. <p>Collapse the side menu to display the main icon.</p>
  52. <div style="margin:20px 0;">
  53. <a href="javascript:;" class="easyui-linkbutton" onclick="toggle()">Toggle</a>
  54. </div>
  55. <div id="sm" class="easyui-sidemenu" data-options="data:data"></div>
  56. </body>
  57. </html>