[英]qtip2 position getting changed after close
I am implementing the qtip2 with fullcalendar jquery plugin. 我正在用fullcalendar jquery插件实现qtip2。 Both are great plugins .
两者都是很棒的插件。 But I have problem with qtip positioning.
但是我对qtip定位有疑问。 I am using the below code.
我正在使用以下代码。
$(window).load(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var tooltip = $('<div/>').qtip({
id: 'calendar',
prerender: true,
overwrite: false,
content: {
text: ' ',
title: {
button: true
}
},
position: {
my: 'bottom center',
at: 'top center',
target: 'mouse',
viewport: $(window),
adjust: {
mouse: false,
scroll: false
}
},
events: {
hide: function(event, api) {
alert('test');
//$(this).qtip("destroy");
}
},
show: false,
hide: false,
style: 'qtip-light'
}).qtip('api');
/* initialize the calendar
-----------------------------------------------------------------*/
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
droppable: true, // this allows things to be dropped onto the calendar !!!
eventClick: function(data, event, view) {
var content = '<h3>'+data.title+'</h3>' +
'<p><b>Start:</b> '+data.start+'<br />' +
(data.end && '<p><b>End:</b> '+data.end+'</p>' || '');
tooltip.set({
'content.text': content
})
.reposition(event).show(event);
},
dayClick: function() { tooltip.hide() },
eventResizeStart: function() { tooltip.hide() },
eventDragStart: function() { tooltip.hide() },
viewDisplay: function() { tooltip.hide() },
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1)
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d+4, 16, 0),
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
},
{
title: 'Lunch',
start: new Date(y, m, d, 12, 0),
end: new Date(y, m, d, 14, 0),
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d+1, 19, 0),
end: new Date(y, m, d+1, 22, 30),
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
}
]
});
});
This is working fine for the first time. 这是第一次正常工作。 I mean when I click on any of event name qtip pop is showing correctly after that if I click inside the popup window or press the close button of the popup window and again click on the event name the position of tool tip got changed .
我的意思是,当我单击任何事件名称时,如果在弹出窗口内单击或按弹出窗口的关闭按钮并再次单击事件名称,则qtip pop会正确显示,提示工具的位置已更改。 It is not displaying on the correct position with event name .
事件名称未显示在正确的位置。
.
。
Second Screen (After closing previous popup and clicking on event name ) 第二屏 (关闭上一个弹出窗口并单击事件名称后)
Please suggest me a solution for this 请为我建议一个解决方案
This appears to be a bug in the reposition() function in qTip2 version 2.1.1. 这似乎是qTip2 2.1.1版的reposition()函数中的错误。 If you use version 2.2.0 it works as expected.
如果您使用版本2.2.0,它会按预期工作。
http://qtip2.com/v/stable/jquery.qtip.js http://qtip2.com/v/stable/jquery.qtip.js
http://qtip2.com/v/stable/jquery.qtip.css http://qtip2.com/v/stable/jquery.qtip.css
It work´s for me, with 2.2.0 version: 它适用于我,具有2.2.0版本:
position: { ..., at: ' ', ... }, 位置:{...,位于:'',...},
tooltip.set({ ..., 'position.at': 'top center' }) tooltip.set({...,'position.at':'顶部中心'})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.