【发布时间】:2014-03-08 05:24:08
【问题描述】:
好的,我每 15 秒进行一次 ajax 调用,这是第一次在进行 ajax 调用时“禁用”工具提示,我修复了这个运行函数并再次调用启动工具提示的函数。
问题是.. 如果在进行 ajax 调用时有一个工具提示“打开”,则该项目的这个并且只有这个工具提示被永久销毁,其余的工作正常。直到 ajax 运行时您再次处于打开的工具提示中。
我该如何解决这个问题..
这是我的代码
function notifications() {
$.ajax(
{
type: "POST",
//data: dataparam,
url: "<?php echo $notifurl;?>",
success: function(msg)
{
if(msg !="")
{
$("#ajaxnotif").empty().html(msg);
$('.tooltip').remove();
ttp();
//$("#suggestDiv").show();
}
else
{
$("#ajaxnotif").empty().html(msg);
$('.tooltip').remove();
ttp();
//$("#suggestDiv").hide();
}
}
});
}
$(document).ready(notifications);
window.setInterval(function(){
notifications();
}, 15000);
var $tooltip = null;
var $tooltip2 = null;
var $tooltip3 = null;
function ttp() {
$tooltip = $('.marcleidnot[title]').tooltip({
delay:0,
slideInSpeed: 300,
slideOutSpeed: 200,
bounce: false,
/*bounce: false*/
relative: false, // <-- Adding this should sort you out
slideOffset: 5,
/* effect: 'slide',
direction: 'down',
slideInSpeed: 300,
slideOutSpeed: 200,*/
position: 'top center'
});
$tooltip2 = $('.fav[title]').tooltip({
delay:100,
slideInSpeed: 300,
slideOutSpeed: 300,
/*bounce: false,*/
relative: false, // <-- Adding this should sort you out
effect: 'slide',
direction: 'down',
/*slideInSpeed: 300,
slideOutSpeed: 200,*/
position: 'top center',
offset: [10, -2]
});
$tooltip3 = $('.nofav[title]').tooltip({
delay:100,
slideInSpeed: 300,
slideOutSpeed: 300,
/*bounce: true,*/
relative: false, // <-- Adding this should sort you out
effect: 'slide',
direction: 'down',
/*slideInSpeed: 300,
slideOutSpeed: 200,*/
position: 'top center',
offset: [10, -2]
});
}
$('body').click(function() {
$('.tooltip').remove();//remove the tool tip element
});
【问题讨论】:
标签: javascript jquery ajax jquery-tools