tabstools.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Tabs Tools - 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>Tabs Tools</h2>
  14. <p>Click the buttons on the top right of tabs header to add or remove tab panel.</p>
  15. <div style="margin:20px 0;"></div>
  16. <div id="tt" class="easyui-tabs" data-options="tools:'#tab-tools'" style="width:700px;height:250px">
  17. </div>
  18. <div id="tab-tools">
  19. <a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-add'" onclick="addPanel()"></a>
  20. <a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-remove'" onclick="removePanel()"></a>
  21. </div>
  22. <script type="text/javascript">
  23. var index = 0;
  24. function addPanel(){
  25. index++;
  26. $('#tt').tabs('add',{
  27. title: 'Tab'+index,
  28. content: '<div style="padding:10px">Content'+index+'</div>',
  29. closable: true
  30. });
  31. }
  32. function removePanel(){
  33. var tab = $('#tt').tabs('getSelected');
  34. if (tab){
  35. var index = $('#tt').tabs('getTabIndex', tab);
  36. $('#tt').tabs('close', index);
  37. }
  38. }
  39. </script>
  40. </body>
  41. </html>