2018-03-25 13:22:28 +02:00
|
|
|
var current = null;
|
|
|
|
var classes = null;
|
2018-03-25 14:19:53 +02:00
|
|
|
$(document).ready(function () {
|
2018-03-26 14:22:35 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Display clicked event as selected, change info box content and scroll to it
|
|
|
|
*/
|
2018-03-25 14:19:53 +02:00
|
|
|
$(".event").click(function () {
|
2018-03-25 13:22:28 +02:00
|
|
|
/* Reset last selected items */
|
|
|
|
if (current != null) {
|
|
|
|
setEventShadow(current, "none");
|
|
|
|
}
|
|
|
|
/* Set style for currently selected items */
|
|
|
|
current = this.className.split(" ")[1];
|
2018-05-20 23:35:17 +02:00
|
|
|
setEventShadow(current, "0px 0px 10px #ee293d");
|
2018-03-25 13:22:28 +02:00
|
|
|
/* Load info box text and smoothly scroll to it */
|
|
|
|
$("#infoBox").load("includes/planning_events/" + current + ".html");
|
|
|
|
$('html, body').animate({
|
2018-06-05 20:03:33 +02:00
|
|
|
scrollTop: $("#info-box-top").offset().top
|
2018-03-25 13:22:28 +02:00
|
|
|
}, 300);
|
|
|
|
});
|
2018-03-26 14:22:35 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Display shadow on hovered events
|
|
|
|
*/
|
2018-03-25 14:19:53 +02:00
|
|
|
$(".event").hover(function () {
|
2018-03-25 13:22:28 +02:00
|
|
|
var element = this.className.split(" ")[1];
|
|
|
|
if (element != current) {
|
2018-05-20 23:35:17 +02:00
|
|
|
setEventShadow(element, "0px 0px 10px #1a5dad");
|
2018-03-25 13:22:28 +02:00
|
|
|
}
|
2018-03-25 14:19:53 +02:00
|
|
|
}, function () {
|
2018-03-25 13:22:28 +02:00
|
|
|
var element = this.className.split(" ")[1];
|
|
|
|
if (element != current) {
|
|
|
|
setEventShadow(element, "none");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-03-26 14:22:35 +02:00
|
|
|
/*
|
|
|
|
* Display shadow under all elements with the save eventName
|
|
|
|
*/
|
2018-03-25 14:19:53 +02:00
|
|
|
function setEventShadow(eventName, shadow) {
|
2018-03-25 13:22:28 +02:00
|
|
|
classes = document.getElementsByClassName(eventName);
|
|
|
|
for (var i = 0; i < classes.length; i++) {
|
|
|
|
classes[i].style.boxShadow = shadow;
|
2018-05-20 23:35:17 +02:00
|
|
|
classes[i].style.textShadow = shadow;
|
2018-03-25 13:22:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|