﻿$(document).ready(function () { var currentTopElement = ""; var firstBox; var classToReach = ""; function moveOtherElements() { $(currentTopElement).css("z-index", "0"); $(currentTopElement).removeAttr("id"); var currentElement; if ($(currentTopElement).attr("class") == "box_6") { currentElement = $(firstBox) } else { currentElement = $(currentTopElement).next() } $(currentElement).attr("id", "top"); if ($(currentElement).attr("class") == "box_1") { $("#rad").css("background", "url(css/images/label_1.png) top left no-repeat") } if ($(currentElement).attr("class") == "box_2") { $("#rad").css("background", "url(css/images/label_2.png) top left no-repeat") } if ($(currentElement).attr("class") == "box_3") { $("#rad").css("background", "url(css/images/label_3.png) top left no-repeat") } if ($(currentElement).attr("class") == "box_4") { $("#rad").css("background", "url(css/images/label_4.png) top left no-repeat") } if ($(currentElement).attr("class") == "box_5") { $("#rad").css("background", "url(css/images/label_5.png) top left no-repeat") } if ($(currentElement).attr("class") == "box_6") { $("#rad").css("background", "url(css/images/label_6.png) top left no-repeat") } $(currentElement).css("z-index", "6"); $(currentElement).find("img").animate({ width: "160px" }, "fast"); $(currentElement).animate({ left: "+=30px", top: "20px" }, "fast"); if ($(currentElement).attr("class") == "box_6") { currentElement = $(firstBox) } else { currentElement = $(currentElement).next() } $(currentElement).css("z-index", "5"); $(currentElement).find("img").animate({ width: "140px" }, "fast"); $(currentElement).animate({ left: "+=25px", top: "40px" }, "fast"); if ($(currentElement).attr("class") == "box_6") { currentElement = $(firstBox) } else { currentElement = $(currentElement).next() } $(currentElement).css("z-index", "4"); $(currentElement).find("img").animate({ width: "120px" }, "fast"); $(currentElement).animate({ left: "+=21px", top: "60px" }, "fast"); if ($(currentElement).attr("class") == "box_6") { currentElement = $(firstBox) } else { currentElement = $(currentElement).next() } $(currentElement).css("z-index", "3"); $(currentElement).find("img").animate({ width: "100px" }, "fast"); $(currentElement).animate({ left: "+=17px", top: "80px" }, "fast"); if ($(currentElement).attr("class") == "box_6") { currentElement = $(firstBox) } else { currentElement = $(currentElement).next() } $(currentElement).css("z-index", "2"); $(currentElement).find("img").animate({ width: "80px" }, "fast"); $(currentElement).animate({ left: "+=12px", top: "100px" }, "fast"); if ($(currentElement).attr("class") == "box_6") { currentElement = $(firstBox) } else { currentElement = $(currentElement).next() } $(currentElement).css("z-index", "1"); $(currentElement).find("img").animate({ width: "60px" }, "fast"); $(currentElement).animate({ left: "5px", top: "120px" }, "fast", rotateUntil) } function rotateOnce() { firstBox = $("#rotating_boxes>a:first"); currentTopElement = $("#top"); $(currentTopElement).find("img").animate({ width: "140px" }, "fast"); $(currentTopElement).animate({ left: "+=140px", top: "40px" }, "fast", moveOtherElements) } function rotateUntil() { if ($("#top").attr("class") != classToReach) { rotateOnce() } } function redirectToURL(topElementClass) { setTimeout(function () { if (topElementClass == "box_1") { document.location.href = "Vereinsportal.aspx" } if (topElementClass == "box_2") { document.location.href = "Elternbildung-Ausserschwyz.aspx.aspx" } if (topElementClass == "box_3") { document.location.href = "Freizeit.aspx" } if (topElementClass == "box_4") { document.location.href = "Fachstellen.aspx" } if (topElementClass == "box_5") { document.location.href = "Team-und-Outfit.aspx" } if (topElementClass == "box_6") { document.location.href = "Spiel-und-Spass.aspx" } }, 2000) } $("#rotating_boxes img").click(function () { var currentElementClass = $(this).parent().attr("class"); classToReach = currentElementClass; if ($("#top").attr("class") != currentElementClass) { rotateUntil() } redirectToURL(currentElementClass); return false }); $("#spinning_arrow a").hover(function () { var rad = $("#rad"); if ($(this).attr("class") == "label_1") { $(rad).css("background", "url(css/images/rad_sprite.png) 0px 0px no-repeat") } if ($(this).attr("class") == "label_2") { $(rad).css("background", "url(css/images/rad_sprite.png) 0px -140px no-repeat") } if ($(this).attr("class") == "label_3") { $(rad).css("background", "url(css/images/rad_sprite.png) 0px -280px no-repeat") } if ($(this).attr("class") == "label_4") { $(rad).css("background", "url(css/images/rad_sprite.png) 0px -420px no-repeat") } if ($(this).attr("class") == "label_5") { $(rad).css("background", "url(css/images/rad_sprite.png) 0px -560px no-repeat") } if ($(this).attr("class") == "label_6") { $(rad).css("background", "url(css/images/rad_sprite.png) 0px -700px no-repeat") } }); $("#spinning_arrow a").click(function () { if ($(this).attr("class") == "label_1") { classToReach = "box_1" } if ($(this).attr("class") == "label_2") { classToReach = "box_2" } if ($(this).attr("class") == "label_3") { classToReach = "box_3" } if ($(this).attr("class") == "label_4") { classToReach = "box_4" } if ($(this).attr("class") == "label_5") { classToReach = "box_5" } if ($(this).attr("class") == "label_6") { classToReach = "box_6" } if ($("#top").attr("class") != classToReach) { rotateUntil() } redirectToURL(classToReach); return false }) });
