JQuery Week Calendar mouseover events

While working with a plugin for JQuery for week calendars. I came across a very annoying little bug. Using mouseover/out events did not seem to work correctly when hovering over the title and time. It just wouldn’t do what it should of.

Well after debugging and messing around for a while, I was able to figure out how to resolve this issue. In jquery.weekcalendar.js open up the file and locate:

          if ($target.hasClass('wc-cal-event')) {
            options.eventMouseover($target.data('calEvent'), $target, event);
          }

After that code we want to add:

          if ($target.hasClass('wc-time') || $target.hasClass('wc-title')) {
            options.eventMouseover($target.parents('.wc-cal-event').data('calEvent'), $target, event);
          }

A little further down the file is:

          if ($target.hasClass('wc-cal-event')) {
            if ($target.data('sizing')) { return;}
            options.eventMouseout($target.data('calEvent'), $target, event);
          }

We want to add after that:

          if ($target.hasClass('wc-time') || $target.hasClass('wc-title')) {
            if ($target.data('sizing')) { return;}
            options.eventMouseout($target.parents('.wc-cal-event').data('calEvent'), $target, event);
          }

This makes it work as I excepted it to. My thoughts here are that the inner divs are removing the mouseover events. So by attaching an event to them as well, it makes it work as well.

As a good GitHub person does, I submitted a pull request with these fixes in hopes that it gets merged into the plugin.

2 Comments

  1. This works great, thx a lot. The mouseover event is really useful if you need to display informations when those are shrinked by the size of the event.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.