From d99f44650cd3130e9a4ecc4c4bf66e79fbd4200a Mon Sep 17 00:00:00 2001 From: substantialnoninfringinguser Date: Mon, 18 May 2009 04:25:42 +0100 Subject: [svn] Turn main menu into dropdown (well actually, drop up) menu. --- media/js/base.js | 61 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 20 deletions(-) (limited to 'media/js/base.js') diff --git a/media/js/base.js b/media/js/base.js index 0dc562b..7a7ed5e 100644 --- a/media/js/base.js +++ b/media/js/base.js @@ -1,4 +1,22 @@ +/* The following serves to stretch the content div to the bottom of the margin images, or vice versa*/ +function contentHeight(){ +setMaxHeight($(".rightMargin,#content,.leftMargin,#col2"),$("#content")); +}; + +function setMaxHeight(group, target) { + tallest = 0; + group.each(function() { + thisHeight = $(this).height(); + if(thisHeight > tallest) { + tallest = thisHeight; + } + }); + target.height(tallest); +} + + +/*This is the jquery comment stuff */ $(document).ready(function() { $('.searchable li').quicksearch({ @@ -19,6 +37,11 @@ $(".toggleEyeCandy").click(function () { $(".toggleEyeCandy").toggle(); }); +$(".toggleMenu").click(function () { + $("ul.dropdown li:not(.toggleMenu)").toggle(); + $(".toggleMenu").toggle(); + }); + $(".nav").css('opacity','7') $(".footer").hide(); $(".fadeIn").hide(); @@ -36,11 +59,11 @@ function linkHover(hoverLink,image){ $(hoverLink).hover( function() { $(image).fadeIn("slow"); - $(hoverLink).css("background","gray"); +/* $(hoverLink).css("background","gray");*/ }, function() { $(image).fadeOut("slow"); - $(hoverLink).css("background","black"); +/* $(hoverLink).css("background","black");*/ } ); @@ -48,27 +71,25 @@ $(hoverLink).hover( }; -linkHover("#expoWebsiteLink","#richardBanner"); -linkHover("#cuccLink","#timeMachine"); +linkHover("#cavesLink","#richardBanner"); +linkHover("#caversLink","#timeMachine"); linkHover("#surveyBinderLink","#surveyHover"); linkHover("#troggle","#timeMachine"); - -}); - -function contentHeight(){ -setMaxHeight($(".rightMargin,#content,.leftMargin,#col2"),$("#content")); -}; - -function setMaxHeight(group, target) { - tallest = 0; - group.each(function() { - thisHeight = $(this).height(); - if(thisHeight > tallest) { - tallest = thisHeight; - } +/*dropdown (well, up actually) menu code from http://css-tricks.com/simple-jquery-dropdowns/*/ +$("ul.dropdown li").hover( + function(){ + $(this).addClass("hover"); + $('ul:first',this).css('visibility','visible') + }, + + function(){ + $(this).removeClass("hover"); + $('ul:first',this).css('visibility', 'hidden'); }); - target.height(tallest); -} + $("ul.dropdown li ul li:has(ul)").find("a:first").append(" » "); +/* end dropdown menu code */ + +}); -- cgit v1.2.3