Created
October 7, 2011 06:47
-
-
Save ncammarata/1269628 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Smart event highlighting | |
| * Handles for when events span rows, or don't have a background color | |
| */ | |
| $(function() { | |
| var highlight_color = "#2EAC6A", | |
| event_id = event_class_name = event_color = null; | |
| $(".ec-event-bg").each(function(ele) { | |
| ele.mouseover(function(evt) { | |
| event_id = ele.attr("data-event-id"); | |
| event_class_name = ele.attr("data-event-class"); | |
| $(".ec-"+event_class_name+"-"+event_id).each(function(el) { | |
| el.css({ backgroundColor: highlight_color }); | |
| }); | |
| }); | |
| ele.mouseout(function(evt) { | |
| event_id = ele.attr("data-event-id"); | |
| event_class_name = ele.attr("data-event-class"); | |
| event_color = ele.attr("data-color"); | |
| $$(".ec-"+event_class_name+"-"+event_id).each(function(el) { | |
| el.css({ backgroundColor: event_color }); | |
| }); | |
| }); | |
| }); | |
| // highlight events that don't have a background color | |
| $(".ec-event-no-bg").each(function(ele) { | |
| ele.mouseover(function(evt) { | |
| ele.css({ color: "white" }); | |
| ele.find("a").each(function(link) { | |
| link.css({ color: "white" }); | |
| }); | |
| ele.find(".ec-bullet").each(function(bullet) { | |
| bullet.css({ backgroundColor: "white" }); | |
| }); | |
| ele.css({ backgroundColor: highlight_color }); | |
| }); | |
| ele.mouseout(function(evt) { | |
| event_color = ele.attr("data-color"); | |
| ele.css({ color: event_color }); | |
| ele.find("a").each(function(link) { | |
| link.css({ color: event_color }); | |
| }); | |
| ele.find(".ec-bullet").each(function(bullet) { | |
| bullet.css({ backgroundColor: event_color }); | |
| }); | |
| ele.css({ backgroundColor: "transparent" }); | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment