요소에서 attr 제목을 제거하려고하면 요소를 가리키는 두 번째 요소가 삭제됩니다.즉, removeAttr title 문제가 발생했습니다.
이 문제는 Internet Explorer에서만 발생합니다. 당신은 단지 mouseover
에 title
속성을 제거하기 때문에
$('span').live({"mouseover": function(){
clearTimeout($(this).data('timeoutId'));
var title = $(this).attr('title');
$(this).removeAttr("title");
if($(this).children('.tip-hover').length > 0){
if($(this).children('.tip-hover').is(':visible') == false){
$(document).find('.tip-hover').hide();
$(this).children('.tip-hover').fadeIn(100);
}else{
$(document).find('.tip-hover').hide();
$(this).children('.tip-hover').show();
}
}else{
if(title != false){
var height = $(this).css('line-height') + 2;
$(this).prepend('<div class="tip-hover"><div class="tip-top"></div><div class="tip-hover-wrap"><div class="tip-hover-inner">' + title + '</div></div></div>');
$(this).children('.tip-hover').css("margin-top", height + "px");
var width = $(this).width()/2;
$(this).children('.tip-hover').css("padding-left",width+"px");
}
}
},
"mouseout": function() {
var someelement = this;
var timeoutId = setTimeout(function(){ $(someelement).find(".tip-hover").fadeOut("slow");}, 350);
$(someelement).data('timeoutId', timeoutId);
}
});
jQuery를 101 : 변수에 $ (이)에 대한 참조를 저장 당신은 필요가 없습니다 그것을 찾는 것은 $() 비싸다. – epascarello
또한 뭔가가 부울 false 값으로 설정되지 않으면'if (title! = false)'가 false가 될 수 없습니다. 속성을 삭제해도 false가 생성되지 않습니다. 그 팁을 – epascarello
고맙습니다! 바로 바꿨어! 내가 어떻게 그럴거야? 제목이 존재하는지 확인하십시오! –