Miguel Diaz commited on
Commit
cc7408f
1 Parent(s): 30dd895

pruebas tabs

Browse files
Files changed (1) hide show
  1. static/main2.html +24 -24
static/main2.html CHANGED
@@ -17,9 +17,9 @@
17
 
18
  <div class="wrapper">
19
  <div class="tab">
20
- <button class="tablinks" >Tab 1</button>
21
- <button class="tablinks" >Tab 2</button>
22
- <button class="tablinks" >Tab 3</button>
23
  </div>
24
  <div id="tab1" class="tabcontent">
25
  <div class="chat" id="chat1"></div>
@@ -56,26 +56,26 @@
56
  $(document).ready(function() {
57
  chatH = new ChatGPT("{% token %}");
58
  windH = new WindowHandler();
59
-
60
- $(function() {
61
- // Al cargar la página se muestra el primer tab y se activa su botón correspondiente
62
- $('.tabcontent:first-child').show();
63
- $('.tablinks:first-child').addClass('active');
64
-
65
- // Al hacer clic en un botón de tab se muestra su contenido correspondiente
66
- $('.tablinks').click(function(e) {
67
- e.preventDefault();
68
- $('.tabcontent').hide();
69
- $('.tablinks').removeClass('active');
70
- $(this).addClass('active');
71
- var tab = $(this).attr('href');
72
- $(tab).show();
73
- });
74
- });
75
- });
76
-
77
-
78
-
79
- </script>
80
  </body>
81
  </html>
 
17
 
18
  <div class="wrapper">
19
  <div class="tab">
20
+ <button class="tablinks" onclick="openTab(event, 'tab1')">Tab 1</button>
21
+ <button class="tablinks" onclick="openTab(event, 'tab2')">Tab 2</button>
22
+ <button class="tablinks" onclick="openTab(event, 'tab3')">Tab 3</button>
23
  </div>
24
  <div id="tab1" class="tabcontent">
25
  <div class="chat" id="chat1"></div>
 
56
  $(document).ready(function() {
57
  chatH = new ChatGPT("{% token %}");
58
  windH = new WindowHandler();
59
+
60
+
61
+
62
+
63
+ function openTab(evt, tabName) {
64
+ var i, tabcontent, tablinks;
65
+
66
+ tabcontent = document.getElementsByClassName("tabcontent");
67
+ for (i = 0; i < tabcontent.length; i++) {
68
+ tabcontent[i].style.display = "none";
69
+ }
70
+
71
+ tablinks = document.getElementsByClassName("tablinks");
72
+ for (i = 0; i < tablinks.length; i++) {
73
+ tablinks[i].className = tablinks[i].className.replace(" active", "");
74
+ }
75
+
76
+ document.getElementById(tabName).style.display = "block";
77
+ evt.currentTarget.className += " active";
78
+ }
79
+ </script>
80
  </body>
81
  </html>