tabstools.html 1.5 KB

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