home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
mcgregor.k12.mn.us
/
www.mcgregor.k12.mn.us.tar
/
www.mcgregor.k12.mn.us
/
ourschoolmenu-collapsed.js
< prev
next >
Wrap
Text File
|
2010-09-08
|
2KB
|
93 lines
/*
Simple JQuery Collapsing menu.
HTML structure to use:
<ul id="menu">
<li><a href="#">Sub menu heading</a>
<ul>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
...
...
</ul>
<li><a href="#">Sub menu heading</a>
<ul>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
<li><a href="http://site.com/">Link</a></li>
...
...
</ul>
...
...
</ul>
Copyright 2007 by Marco van Hylckama Vlieg
web: http://www.i-marco.nl/weblog/
email: marco@i-marco.nl
Free for non-commercial use
*/
function initMenus() {
$('ul.menu ul').hide();
$.each($('ul.menu'), function(){
$('#' + this.id + '.expandfirst ul:first').show();
});
$('ul.menu li a').click(
function() {
var checkElement = $(this).next();
var parent = this.parentNode.parentNode.id;
if($('#' + parent).hasClass('noaccordion')) {
$(this).next().slideToggle('normal');
return false;
}
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
if($('#' + parent).hasClass('collapsible')) {
$('#' + parent + ' ul:visible').slideUp('normal');
}
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#' + parent + ' ul:visible').slideUp('normal');
checkElement.slideDown('normal');
return false;
}
}
);
}
$(document).ready(function() {initMenus();});
if (location.pathname == 'aboutSchool.php')
{
//place jQuery code to be run here
$("#m1").slideDown("slow");
}
else if (location.pathname == 'examplepage.php')
{
$("#m2").slideDown("slow");
}
//...add more "else if" statements here, BEFORE "else" statement
else
{
//if all other conditions are not met, then run the code that is placed here.
//leave blank if you don't want anything else to happen.
}
function initMenu() {
$('#menu ul').hide();
$('#menu li a').hover(
function() {
$(this).next().slideToggle('slow');
return false;
}
);
}
$(document).ready(function() {initMenu();});