我试图显示qtip以响应用户在fullcalendar中每天点击一次。QTip在错误位置显示
这可以在Chrome浏览器中正常工作,但Firefox和Internet Explorer中的qtip会在错误的位置打开。
这可以通过点击不同日期看到,有时qtip将打开在错误的位置,其他时间将打开,然后立即关闭。
当不使用$(this).qtip('destroy')
并且定义了solo: false
时,可以观察到此行为。
如果您在同一单元格内移动鼠标并再次单击正确位置的qtip显示器,它似乎会在您首次单击单元格内部时发生。然后,该单元格继续正常工作,直到页面刷新。
完整的例子可在https://gist.github.com/1467702
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="fullcalendar.css">
<link rel="stylesheet" type="text/css" href="jquery.qtip.css">
</head>
<body>
<div id="calendar"></div>
<script type="text/javascript" src="jquery-1.6.3.js"></script>
<script type="text/javascript" src="jquery.qtip.js"></script>
<script type="text/javascript" src="fullcalendar.js"></script>
<script type="text/javascript">
$(function() {
$('#calendar').fullCalendar({
dayClick: dayclick
});
});
function dayclick(date, allday, jsevent) {
var randomContent = new Date().valueOf().toString();
$(this).qtip({
overwrite: true,
content: {
text: randomContent,
title: {
text: 'Testing',
button: 'Close'
}
},
show: {
solo: true,
event: 'click',
ready: true
},
style: {
tip: true
},
position: {
viewport: $(window),
target: 'mouse',
my: 'bottom center',
at: 'top center',
adjust: {
mouse: false
}
},
hide: {
fixed: true,
delay: 300
},
events: {
hide: function() {
$(this).qtip('destroy');
}
}
}, jsevent);
}
</script>
</body>
</html>