Here是我的代碼:爲什麼.remove()不會刪除該元素?
$(document).ready(function(){
$('a').bind('mouseenter', function() {
var self = $(this);
this.iid = setTimeout(function() {
var tag_name = self.text(),
top = self.position().top + self.outerHeight(true),
left = self.position().left;
$('body').append("<div class='tag_info'>Some explanations about "+tag_name+"</div>");
$(".tag_info").css({top: top + "px", left: left + "px"}).fadeIn(200);
}, 525);
}).bind('mouseleave', function(){
if(this.iid){
clearTimeout(this.iid)
remove($('.tag_info'));
}
});
});
正如您在小提琴看到我提供,當你的鼠標離開的標籤,即黑匣子仍然存在。爲什麼?我該如何刪除它?
嘗試'$( 'tag_info')。remove()方法' – ThisGuyHasTwoThumbs
你爲什麼不這樣做與' :hover'? –