From: Matthijs Kooijman Date: Wed, 24 Jun 2009 16:55:40 +0000 (+0200) Subject: Add some javascript for the exodus homepage. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fwipi.git;a=commitdiff_plain;h=f4a3d0b205c02dcbaca233d78bffeab840803b03 Add some javascript for the exodus homepage. --- diff --git a/static/exodus/js/homepage.js b/static/exodus/js/homepage.js new file mode 100644 index 0000000..7731298 --- /dev/null +++ b/static/exodus/js/homepage.js @@ -0,0 +1,38 @@ +var active = false; + +//changes the preview image +function switchCloseup(to) { + /* Deselect all closeups */ + $(".closeup div").removeClass('selected'); + /* Select the wanted one */ + $(".closeup div." + to).addClass('selected'); +} + +//hides all previewcontent and reveales the selected info +function switchInfo(cls) { + /* Deselect all summaries */ + $(".summary div").removeClass('selected'); + /* Select the wanted one */ + $(".summary div." + cls).addClass('selected'); + /* Save the selected area to reset to on mouseout */ + active = cls; +} + +//after loading the document do this: +$(document).ready( function () { + $("area").mouseout (function (){ + /* Switch back to the selected area */ + switchCloseup(active); + }); + + $("area").mousemove (function (){ + /* Switch to the area we're hovering over */ + switchCloseup($(this).attr('class')); + }); + + $("area").click (function (){ + /* Select a different area */ + switchInfo($(this).attr('class')); + return false; + }); +});