Performance improvment for calender tooltip

This commit is contained in:
Hadi Nategh 2014-10-23 13:31:43 +00:00
parent 2903ca4e7f
commit 32a52e75b0

View File

@ -429,8 +429,12 @@ app.classes.calendar = AppJS.extend(
jQuery("body")
//mouseover event handler for calendar tooltip
.on("mouseover", "div[data-tooltip]",function(){
var ttp = jQuery(this).tooltip({
//Check if the tooltip is already initialized
if (!jQuery(this).data('uiTooltip'))
{
jQuery(this).tooltip({
items: "[data-tooltip]",
show: false,
content: function()
{
var elem = jQuery(this);
@ -442,9 +446,11 @@ app.classes.calendar = AppJS.extend(
open: function(event,ui){
ui.tooltip.removeClass("ui-tooltip");
ui.tooltip.addClass("calendar_uitooltip");
},
close: function( event, ui )
if (this.scrollHeight > this.clientHeight)
{
// bind on tooltip close event
jQuery(this).on("tooltipclose", function (event, ui){
// bind hover handler on tooltip helper in order to be able to freeze the tooltip and scrolling
ui.tooltip.hover(
function () {
if (this.scrollHeight > this.clientHeight) jQuery(this).stop(true).fadeTo(100, 1);
@ -453,14 +459,20 @@ app.classes.calendar = AppJS.extend(
jQuery(this).fadeOut("100", function(){ jQuery(this).remove();});
}
);
});
}
}
});
ttp.tooltip("enable");
}
})
// mousedown event handler for calendar tooltip to remove disable tooltip
.on("mousedown", "div[data-tooltip]", function(){
// Make sure the tooltip initialized before calling it
if (jQuery(this).data('uiTooltip'))
{
jQuery(this).tooltip("disable");
}
})
//onClick event handler for calendar Events