我創建了一個鏈接時,將用戶懸停,有些圖像會蹦出來,當他們走出徘徊,圖像將消失。一切工作都很完美,但是,當他們將鼠標懸停在鏈接上多次時,圖像會一直彈出,直到完成爲止,具體取決於鏈接懸停的次數。有什麼辦法可以延遲執行懸停事件來防止這種情況發生?我的代碼如下防止鼠標懸停在重複多次徘徊
$('.my_link a').bind('mouseover', function() {
var my_title = $(this).html();
var title_width = parseInt($(this).width());
var next = $(this).next();
$.ajax({
type: "POST",
url: 'ajax/my_info_hover.php',
data: {
my_title: my_title
}
}).success(function (data) {
//Disable mouseover from this class?
$('.my_info_wrap').remove();
$(next).html(data).css('left', title_width + 10 + 'px');
});
}).mouseout(function() {
//Enable mouseover again?
$('.my_info_wrap').remove();
});
你在AJAX功能得到什麼exaclty? – adeneo 2013-04-28 19:18:53