Advertisement
BakerMan

Tooltip Nudge Fix (The Events Caledar/PRO 2.0.10)

Nov 14th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * This is an amended version of events-mini-ajax.js to resolve the tooltip
  3.  * issue raised by Louise.
  4.  *
  5.  * Before using, backup the original code!
  6.  *
  7.  * @see http://tri.be/support/forums/topic/events-calendar-widget-right-tooltip-no-longer-aligning-after-navigating/
  8.  */
  9. jQuery(document).ready(function($) {
  10.     /**
  11.      * This is effectively the same function as defined in events.js,
  12.      * however it cannot be reached from within this function so we'll
  13.      * replicate it here as a workaround.
  14.      */
  15.     function tribe_event_nudge() {     
  16.         // prepare calendar for popups
  17.         $('table.tribe-events-calendar tbody tr, table.tribe-events-grid tr.tribe-week-events-row').each(function() {
  18.             // add a class of "tribe-events-right" to last 3 days of week so tooltips stay onscreen. To be replaced by php.
  19.             $(this).find('td:gt(3)').addClass('tribe-events-right');
  20.         });
  21.     }
  22.    
  23.     // handler for tribe events calendar widget ajax call. jquery 1.4 minimum
  24.  
  25.     $('#calendar_wrap .tribe-mini-ajax').live( 'click', function(e){
  26.         e.preventDefault();    
  27.         var month_target = $(this).attr("data-month");
  28.         var params = {
  29.             action: 'calendar-mini',
  30.             eventDate: month_target
  31.         };
  32.         $("#tribe-mini-ajax-month").hide();
  33.         $("#ajax-loading-mini").show();
  34.         $.post(
  35.             TribeMiniCalendar.ajaxurl,
  36.             params,
  37.             function ( response ) {
  38.                 $("#ajax-loading-mini").hide();
  39.                 $("#tribe-mini-ajax-month").show();
  40.                 $("#calendar_wrap").html( response );
  41.                
  42.                 // Let's nudge the tooltips back into line
  43.                 tribe_event_nudge();
  44.             }
  45.         );
  46.     });  
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement