Reputation: 14133
This works - JSFiddle
$("#FullCalendar").fullCalendar({
timezone: false,
defaultView: "agendaWeek",
eventLimit: true,
events: [{
title: 'event1',
start: moment().startOf('day').add(8,'hours')
}],
eventAfterRender: function(event, element) {
var $viewport = $(".fc-time-grid-container.fc-scroller");
var qapi = $(element).qtip({
content: "woo",
hide: {
event: false
}
}).qtip('api');
$viewport.on("scroll", function () {
qapi.reposition();
});
qapi.show();
event.qapi = qapi;
},
eventDestroy: function( event, element, view ) {
event.qapi.destroy();
},
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
}
});
qApi.reposition
so the qtip remains pointed at the event.The problem is that it isn't hidden when you scroll down far enough:
I found several places that say the solution is to set position.container
as the scrolling div which should take care of this problem (and maybe the need for a scroll event listener too). But position.container
only seems to break things for me.
None of these work: (JSFiddle)
position: {
//container: element.parent()
//container: element
container: $viewport
}
I've also tried using position.viewport
and position.target
.
Upvotes: 0
Views: 1077
Reputation: 1925
You can check if the element is visible after scrolling, and show/hide the qtip accordingly.
$viewport.on("scroll", function () {
if(isScrolledIntoView(element[0])) {
qapi.show();
qapi.reposition();
}
else {
qapi.hide();
}
});
Edit: A nice way to check element visibility can be found here
Upvotes: 1