问题
I'm looking at using fullCalendar and using qTip to display a description using eventMouseover.
Has anyone managed to do this or know of a solution? I've google'd and also tried implementing this post but i've had no joy. The only time I got it to work it got into a loop and crashed my browser.
Any advice / support would be greatly appreciated.
Von Schmytt.
UPDATED: Here's the code i'm starting off with (aware it's an example script but, if I could get qTip integrated I could progress). I have qTip, etc ready to use. I just don't know where to start with this now? Thanks again.
UPDATED: 15th July 2010. Can anyone help please?
<script type='text/javascript'>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
theme: false,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: false,
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1),
description: 'Blah blah blah blah blah blah blah'
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2),
description: 'Blah blah blah blah blah blah blah'
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false,
description: 'Blah blah blah blah blah blah blah'
}
]
});
});
</script>
回答1:
Try downloading jquery.qtip-1.0.js
The RC's don't seem to work but 1.0 does (I found that on another forum). I have QTip working with this code:
eventRender: function (event, element) {
element.qtip({
content: {
title: { text: event.title },
text: '<span class="title">Start: </span>' + ($.fullCalendar.formatDate(event.start, 'hh:mmtt')) + '<br><span class="title">Description: </span>' + event.description
},
show: { solo: true },
//hide: { when: 'inactive', delay: 3000 },
style: {
width: 200,
padding: 5,
color: 'black',
textAlign: 'left',
border: {
width: 1,
radius: 3
},
tip: 'topLeft',
classes: {
tooltip: 'ui-widget',
tip: 'ui-widget',
title: 'ui-widget-header',
content: 'ui-widget-content'
}
}
});
}
回答2:
I'd recommend checking out http://craigsworks.com/projects/forums/thread-google-calendar-like-bubble-for-jquery-fullcalendar.
I've got it working (sort of) with this
viewDisplay: function(view) {
var calendar = $(this);
alert('Google calendars loaded');
$('.fc-event').each(function(){
// Grab event data
var title = $(this).find('.fc-event-title').text(),
data = calendar.data('fullCalendar').clientEvents(function(event){
return event.title === title;
})[0];
var qtipContent = data.description ? data.description : data.title;
$(this).qtip({
content: qtipContent,
position: {
corner: {
target: 'topRight',
tooltip: 'bottomLeft'
}
},
show: 'mouseover',
hide: 'mouseout',
style: {
width: 200,
padding: 5,
background: '#A2D959',
color: 'black',
textAlign: 'center',
border: {
width: 7,
radius: 5,
color: '#A2D959'
},
tip: true
}
});
});
return false;
},
It's sort of working in that my qtips don't happen without that alert (no idea why yet). Also, mine's only working in Firefox and IE6 (how frikkin weird is that!).
回答3:
While I have not used qtip specifically, I did something close to what you did using the eventRender callback like stated here.
Your code should look something like:
$('#calendar').fullCalendar({
events: [
{
title: 'My Event',
start: '2010-01-01',
description: 'This is a cool event'
}
// more events here
],
eventRender: function(event, element) {
element.qtip({
content: event.description
});
}
});
Let me know if that helps at all, otherwise once I get home tonight I can have a closer look.
来源:https://stackoverflow.com/questions/3111365/jquery-fullcalendar-and-qtip