home *** CD-ROM | disk | FTP | other *** search
/ mcgregor.k12.mn.us / www.mcgregor.k12.mn.us.tar / www.mcgregor.k12.mn.us / content / menu-collapsed.js < prev    next >
Text File  |  2010-09-08  |  1KB  |  70 lines

  1.  
  2. /* 
  3.    Simple JQuery Collapsing menu.
  4.    HTML structure to use:
  5.  
  6.    <ul id="menu">
  7.      <li><a href="#">Sub menu heading</a>
  8.      <ul>
  9.        <li><a href="http://site.com/">Link</a></li>
  10.        <li><a href="http://site.com/">Link</a></li>
  11.        <li><a href="http://site.com/">Link</a></li>
  12.        ...
  13.        ...
  14.      </ul>
  15.      <li><a href="#">Sub menu heading</a>
  16.      <ul>
  17.        <li><a href="http://site.com/">Link</a></li>
  18.        <li><a href="http://site.com/">Link</a></li>
  19.        <li><a href="http://site.com/">Link</a></li>
  20.        ...
  21.        ...
  22.      </ul>
  23.      ...
  24.      ...
  25.    </ul>
  26.  
  27. Copyright 2007 by Marco van Hylckama Vlieg
  28.  
  29. web: http://www.i-marco.nl/weblog/
  30. email: marco@i-marco.nl
  31.  
  32. Free for non-commercial use
  33. */
  34.  
  35.  
  36.  
  37.  
  38.  
  39. function initMenu() {
  40.   $('#menu ul').slideToggle();
  41.  
  42.   $('#menu li a').hover(
  43.     function() {
  44.         $(this).next().slideToggle('slow');    
  45.         return false;
  46.         
  47.         
  48.       }
  49.     );
  50.    
  51.   }
  52. $(document).ready(function() {initMenu();});
  53.  
  54.  
  55. if (location.pathname == 'aboutSchool.php')
  56. {
  57. //place jQuery code to be run here
  58.  
  59. $("#m1").slideToggle("slow");
  60. }
  61. else if (location.pathname == 'examplepage.php')
  62. {
  63. $("#m2").slideToggle("slow");
  64. }
  65. //...add more "else if" statements here, BEFORE "else" statement
  66. else
  67. {
  68. //if all other conditions are not met, then run the code that is placed here.
  69. //leave blank if you don't want anything else to happen.
  70. }