php - active according base on page/file name -
in project have 1 according menu h2 if click menu name h2 open , show subment. default it's 1st (governing body) open..so when click link add gallery it's go page , gallery management open (active) , rest of close. open 1st 1 (governing body) ..
how that. idea. jquery or php no problem. make work…
please check http://jsfiddle.net/km4w6/
$(document).ready(function(){ //sub menu //set default open/close settings $('.acc_container').hide(); //hide/close containers //$('.acc_trigger:first').addclass('active').next().show(); //add "active" class first trigger, show/open immediate next container //on click $('.acc_trigger').click(function(){ if( $(this).next().is(':hidden') ) { //if immediate next container closed... $('.acc_trigger').removeclass('active').next().slideup(); //remove .acc_trigger classes , slide immediate next container $(this).toggleclass('active').next().slidedown(); //add .acc_trigger class clicked trigger , slide down immediate next container } return false; //prevent browser jump link anchor }); }); <div class="navarea"> <h2 class="acc_trigger">governing body</h2> <div class="acc_container"> <ul> <li><a href="new_position.php">add position</a></li> <li><a href="list_position.php">edit/delete position</a></li> <li><a href="new_member.php">add member</a></li> <li><a href="list_member.php">edit/delete member</a></li> </ul> </div> <h2 class="acc_trigger">gallery managment</h2> <div class="acc_container"> <ul> <li><a href="new_gallery_info.php">add gallery</a></li> <li><a href="list_gallery_info.php">edit/delete gallery</a></li> <li><a href="list_gallery_images.php">gallery images management</a></li> </ul> </div> <h2 class="acc_trigger">other</h2> <div class="acc_container"> <ul> <li><a href="cms.php?page='about_us'">about us</a></li> <li><a href="new_link.php">add link</a></li> <li><a href="list_link.php">edit/delete link</a></li> <li><a href="new_event.php">add event</a></li> <li><a href="list_event.php">edit/delete event</a></li> </ul> </div> </div>
assuming have different page/url detect, can this:
if(window.location.indexof('_gallery')>0){ $('.acc_trigger:contains("gallery managment")').click(); } else if(window.location.indexof('_position')>0 || window.location.indexof('_member')>0){ $('.acc_trigger:contains("governing body")').click(); }
Comments
Post a Comment