Difference between revisions of "Template:Uppsala/Navbar"

m
Line 13: Line 13:
 
<script>
 
<script>
  
// This is the jquery part of your template.  Try not modify any of this code since it makes your menu work.
 
 
$(document).ready(function() {
 
 
$("#HQ_page").attr('id','');
 
 
 
if ( wgPageName.substring( 0,  8) == "Template")  {  // if the page is a template it displays the full name in a single line
 
$("#team_name").html( wgPageName );
 
}
 
 
else if (  ( (wgPageName.match(/\//g) || []).length ) == 0 ) {  // if it is the home page , just print the team's name
 
$("#team_name").html( wgPageName.substring( 5, wgPageName.length ) );
 
}
 
 
else {
 
// this adds the team's name as an h1
 
$("#team_name").html( wgPageName.substring( 5 , wgPageName.indexOf("/")  ) );
 
 
// this adds the page's title as an h4
 
$("#page_name").html (    ( wgPageName.substring( wgPageName.indexOf("/") + 1, wgPageName.length ) ).replace( /\/|_/g , " ")  );
 
}
 
 
 
 
$('#accordion').find('.menu_item').click(function(){
 
 
//Expand or collapse this panel
 
submenu = $(this).find('.submenu');
 
submenu.toggle();
 
 
icon = $(this).find('.icon');
 
 
if ( !$( submenu ).is(':visible') ) {
 
icon.removeClass("less").addClass("plus");
 
}
 
else {
 
icon.removeClass("plus").addClass("less");
 
}
 
 
//Hide the other panels
 
$(".submenu").not(submenu).hide();
 
$(".icon").not(icon).removeClass("less").addClass("plus");
 
});
 
 
 
$(".collapsable_menu_control").click(function() {
 
$(".menu_item").toggle();
 
});
 
 
$( window ).resize(function() {
 
$(".menu_item").show();
 
});
 
 
 
});
 
  
 
</script>
 
</script>

Revision as of 13:29, 19 October 2017