I am trying to select what accordion has the .active
class set based on the results of a switch/case statement.
I currently have a switch/case statement set to hide tabs depending on the statement.
<script>
$(function () {
$("#accordion-test").accordion({
collapsible: true,
active: '#accordion-test .active'
});
});
</script>
<div id="accordion-test">
<h3 class="content1 one">Content Title</h3>
<div align="left">
<p>Content for 1 Goes Here</p>
</div>
<h3 class="two">Content Title</h3>
<div align="left">
<p>Content for 2 Goes Here</p>
</div>
<h3 class="active three">Content Title</h3>
<div align="left">
<p>Content for 3 Goes Here</p>
</div>
</div>
The statement
the session varible is set to one, two or three
<?php
switch ($_SESSION['session']) {
case "one":
?>
<style type="text/css">
.two,.three {
display: none !important;
}
</style>
<?php
break;
case "one":
?>
<style type="text/css">
.two,.three {
display: none !important;
}
</style>
<?php
break;
case "two":
?>
<style type="text/css">
.one,.three {
display: none !important;
}
</style>
<?php
case "three":
?>
<style type="text/css">
.one,.two{
display: none !important;
}
</style>
}
<?php
with this statement I can show or hide accordion tabs depending on the variable present one
,two
or three
.
I would now like to make the displayed accordion tab active,
for example
case "one":
?>
<style type="text/css">
.two,.three {
display: none !important;
}
HAVE ACTIVE STATE APPLIED TO ACCORDION TAB ONE
</style>
<?php
<?php
case "three":
?>
<style type="text/css">
.one,.two{
display: none !important;
}
HAVE ACTIVE STATE APPLIED TO ACCORDION TAB THREE
</style>
<?php