Advertisement
Guest User

hontabs v2

a guest
Jan 15th, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. <style>
  2. body {
  3. background: #051021;
  4. color: #FFF;
  5. }
  6.  
  7. .hontabmenu {
  8. width: 760px;
  9. min-height: 400px;
  10. margin: 20px;
  11. padding: 10px;
  12. /* background: #444; */
  13. border: 1px solid #444;
  14. margin-bottom: 15px;
  15. -moz-border-radius: 10px;
  16. background: #051021;
  17. color: #FFF;
  18. font: 8pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
  19. }
  20.  
  21. .tabcontent {
  22. display: none;
  23. margin-top: 2px;
  24. background: #232a3b;
  25. border: 1px solid #333;
  26. padding: 5px;
  27. -moz-border-radius: 10px;
  28. text-align: center;
  29. }
  30.  
  31. .tab {
  32. text-align: center;
  33. }
  34.  
  35. .tab button {
  36. display: inline;
  37. list-style: none;
  38. padding-right: 5px;
  39. background-color: transparent;
  40. color: #FFF;
  41. border: 0;
  42. padding: 6px;
  43. margin-top: 0;
  44. margin-bottom: 0;
  45. font-weight: bold;
  46. text-transform: uppercase;
  47. outline: none;
  48. font-family: verdana;
  49. font-size: 8pt;
  50. }
  51.  
  52. .tab button:hover {
  53. background-color: #707070;
  54. padding: 6px;
  55. color: #FFFFFF;
  56. border: 0;
  57. }
  58.  
  59. .tab button.active {
  60. background-color: #707070;
  61. padding: 6px;
  62. color: #FFFFFF;
  63. border: 0;
  64. }
  65. </style>
  66.  
  67. <div class="hontabmenu">
  68. <div class="tab">
  69. <button class="tablinks" onclick="openhonTab(event, 'Tab1')">Tab1</button>
  70. <button class="tablinks" onclick="openhonTab(event, 'Tab2')">Tab2</button>
  71. </div>
  72.  
  73. <!-- Tab content -->
  74. <div id="Tab1" class="tabcontent">
  75. <h2>Tab1</h2>
  76. <p>The tab 1 content.</p>
  77. </div>
  78.  
  79. <div id="Tab2" class="tabcontent">
  80. <h2>Tab2</h2>
  81. <p>The tab 2 content.</p>
  82. </div>
  83.  
  84. </div>
  85.  
  86. <script>function openhonTab(evt, tabName) {
  87. // Declare all variables
  88. var i, tabcontent, tablinks;
  89.  
  90. // Get all elements with class="tabcontent" and hide them
  91. tabcontent = document.getElementsByClassName("tabcontent");
  92. for (i = 0; i < tabcontent.length; i++) {
  93. tabcontent[i].style.display = "none";
  94. }
  95.  
  96. // Get all elements with class="tablinks" and remove the class "active"
  97. tablinks = document.getElementsByClassName("tablinks");
  98. for (i = 0; i < tablinks.length; i++) {
  99. tablinks[i].className = tablinks[i].className.replace(" active", "");
  100. }
  101.  
  102. // Show the current tab, and add an "active" class to the button that opened the tab
  103. document.getElementById(tabName).style.display = "block";
  104. evt.currentTarget.className += " active";
  105. }
  106.  
  107. document.getElementsByClassName = function(cl) {
  108. var retnode = [];
  109. var elem = this.getElementsByTagName('*');
  110. for (var i = 0; i < elem.length; i++) {
  111. if((' ' + elem[i].className + ' ').indexOf(' ' + cl + ' ') > -1) retnode.push(elem[i]);
  112. }
  113. return retnode;
  114. };
  115. </script>
  116.  
  117. <style>
  118. /* FADE EFFECT */
  119. .tabcontent {
  120. animation: fadeEffect 1s;
  121. }
  122.  
  123. @keyframes fadeEffect {
  124. from {opacity: 0;}
  125. to {opacity: 1;}
  126. }
  127. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement