php - Custom accordion pannel not working properly -


i have accordion script:

$(document).ready(function(){ $(function(){   //  accordion panels   $(".accordion span").hide();    $(".accordion li").click(function(){       $(this).next(".pane").slidetoggle("fast").siblings(".pane:visible").slideup("fast");   }); }); }); 

and php script:

echo "<u>organizational chart</u><br/>";         echo "<div class='accordion'>"; $select_branch=mysql_query("select * branch"); while($result_branch=mysql_fetch_array($select_branch)){     $branch1=$result_branch[1];     if($branch1!='top'){         echo "<li>".$branch1."</li>";         echo "<div class='pane'>";     }     $select_department=mysql_query("select * departments");         while($result_department=mysql_fetch_array($select_department)){             $department=$result_department[1];             $parent_department=$result_department[2];             $select_staff=mysql_query("select * organization branch='$branch1' , department='$department'");                 while($result_staff=mysql_fetch_array($select_staff)){                     $fname=$result_staff[1];                     $mname=$result_staff[2];                     $lname=$result_staff[3];                     $department=$result_staff[4];                     $branch=$result_staff[5];                     $position=$result_staff[6];                     $status=$result_staff[7];                     $pic=$result_staff[8];                     echo "                         <div class='staffdiv'>                             <img class='staffpic' src='images/upload/".$pic."'/>                             <div style='clear:both'></div>                             <div class='staffdetails'>                                 ".$fname." ".$mname." ".$lname."<br/>                                 ".$position."<br/>                             </div>                         </div>                     ";                 }         }     if($branch1!='top'){         echo "</div>";     } }         echo "</div>"; 

when run page panel open , when click 1 panel, content hide , start working properly, how can fix code? did missed something.

i'm sorry long code post, hoping can me problem.

try assigning active property false default. work, collapsible must true.

$( ".accordion" ).accordion({ active: false, collapsible: true }); 

refer: http://api.jqueryui.com/accordion/#option-active


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -