Add some javascript for the exodus homepage.
[matthijs/projects/wipi.git] / static / exodus / js / homepage.js
diff --git a/static/exodus/js/homepage.js b/static/exodus/js/homepage.js
new file mode 100644 (file)
index 0000000..7731298
--- /dev/null
@@ -0,0 +1,38 @@
+var active = false;\r
+\r
+//changes the preview image\r
+function switchCloseup(to) {\r
+       /* Deselect all closeups */\r
+       $(".closeup div").removeClass('selected');\r
+       /* Select the wanted one */\r
+       $(".closeup div." + to).addClass('selected');\r
+}\r
+\r
+//hides all previewcontent and reveales the selected info\r
+function switchInfo(cls) {\r
+       /* Deselect all summaries */\r
+       $(".summary div").removeClass('selected');\r
+       /* Select the wanted one */\r
+       $(".summary div." + cls).addClass('selected');\r
+       /* Save the selected area to reset to on mouseout */\r
+       active = cls;\r
+}\r
+\r
+//after loading the document do this:\r
+$(document).ready( function () {\r
+       $("area").mouseout (function (){\r
+               /* Switch back to the selected area */\r
+               switchCloseup(active);\r
+       });\r
+\r
+       $("area").mousemove (function (){\r
+               /* Switch to the area we're hovering over */\r
+               switchCloseup($(this).attr('class'));\r
+       });\r
+\r
+       $("area").click (function (){\r
+               /* Select a different area */\r
+               switchInfo($(this).attr('class'));\r
+               return false;\r
+       });\r
+});\r