User:Vinoo/AccordionMenu

From 2014.igem.org

< User:Vinoo(Difference between revisions)
m
m
 
Line 1: Line 1:
<html>
<html>
-
 
-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
 
-
<script type="text/javascript">
 
-
$(document).ready( function() {
 
-
 
-
// initialize accordion
 
-
$('#acc_menu ul').each( function() {
 
-
var currentURI = window.location.href;
 
-
var links = $('a', this);
 
-
var collapse = true;
 
-
for (var i = 0; i < links.size(); i++) {
 
-
var elem = links.eq(i);
 
-
var href = elem.attr('href');
 
-
var hrefLength = href.length;
 
-
var compareTo = currentURI.substr(-1*hrefLength);
 
-
 
-
if (href == compareTo) {
 
-
collapse = false;
 
-
break;
 
-
}
 
-
};
 
-
if (collapse) {
 
-
$(this).hide();
 
-
}
 
-
});
 
-
 
-
// on click, show this element and hide all others
 
-
$('#acc_menu > li').click( function() {
 
-
var me = $(this).children('ul');
 
-
$('#acc_menu ul').not(me).slideUp();
 
-
me.slideDown();
 
-
});
 
-
});
 
-
</script>
 
-
 
-
 
<style type="text/css">
<style type="text/css">
#acc_menu,
#acc_menu,

Latest revision as of 20:04, 12 December 2013