0c10c6497cb59e65d07c69ec8e4e4cd14dfb921e.svn-base 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Add and Remove Layout - 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. </head>
  12. <body>
  13. <h2>Add and Remove Layout</h2>
  14. <p>Click the buttons below to add or remove region panel of layout.</p>
  15. <div style="margin:20px 0;">
  16. <span>Select Region Panel:</span>
  17. <select id="region">
  18. <option value="north">North</option>
  19. <option value="south">South</option>
  20. <option value="east">East</option>
  21. <option value="west">West</option>
  22. </select>
  23. <a href="javascript:void(0)" class="easyui-linkbutton" onclick="addPanel()">Add</a>
  24. <a href="javascript:void(0)" class="easyui-linkbutton" onclick="removePanel()">Remove</a>
  25. </div>
  26. <div id="cc" class="easyui-layout" style="width:700px;height:350px;">
  27. <div data-options="region:'north'" style="height:50px"></div>
  28. <div data-options="region:'south',split:true" style="height:50px;"></div>
  29. <div data-options="region:'east',split:true" title="East" style="width:100px;"></div>
  30. <div data-options="region:'west',split:true" title="West" style="width:100px;"></div>
  31. <div data-options="region:'center',title:'Center'"></div>
  32. </div>
  33. <script type="text/javascript">
  34. function addPanel(){
  35. var region = $('#region').val();
  36. var options = {
  37. region: region
  38. };
  39. if (region=='north' || region=='south'){
  40. options.height = 50;
  41. } else {
  42. options.width = 100;
  43. options.split = true;
  44. options.title = $('#region option:selected').text();
  45. }
  46. $('#cc').layout('add', options);
  47. }
  48. function removePanel(){
  49. $('#cc').layout('remove', $('#region').val());
  50. }
  51. </script>
  52. </body>
  53. </html>