私はphp、javascript、jqueryを暗示するWebサイトに取り組んでいます。2 つのタブと 2 番目のタブ内にアコーディオンがあります。アコーディオンのセクションからリンクをクリックすると、ウェブサイトがタブ 2 とタブ 1 を切り替えます。ご返事ありがとうございます!
以下は私の書いたコードです:
<!-- Inside the head tag of index.php -->
$(function() {
$( "#accordion" ).accordion({
heightStyle: "content"
});
});
$(function() {
$( "#tabs" ).tabs();
});
<!-- Inside the <body> tag of index.php -->
<div id="tabs">
<ul>
<li><a href="#tabs-1">Home</a></li>
<li><a href="#tabs-2">Products</a></li>
</ul>
<div class="tab" id="tabs-1">
<h1>Content tab 1</h1>
</div>
<div class="tab" id="tabs-2">
<!-- The tab contains a table (one row, two columns). First column contains the
accordion, the second column shows the content behind the Products list item.
-->
<table>
<tr>
<td width="300">
<div id="accordion">
<h3>Products</h3>
<div>
<ul>
<li><a href="index.php?pag=x1#tabs-2">Type 1</a></li>
<li><a href="index.php?pag=x2#tabs-2">Type 2</a></li>
</ul>
</div>
</div>
</td>
<td>
<?php
if(isset($_GET['pag'])){
switch($_GET['pag']){
case 'x1':include("pages/X1.php");break;
case 'x2':include("pages/X2.php");break;
default: include("pages/ui.php");
}
}else include("pages/ui.php");
?>
</td>
</tr>
</table>
</div>
</div>