【JQ学習ノート】ヒントの効果
4288 ワード
<p><a href="#" class="tooltip" title=" 1."> 1.</a></p>
<p><a href="#" class="tooltip" title=" 2."> 2.</a></p>
<p><a href="#" title=" 1."> 1.</a></p>
<p><a href="#" title=" 2."> 2.</a></p>
$(function(){
$(".tooltip").mouseenter(function(e){
this.mytitle=this.title
this.title=""
var a="<div>"+this.mytitle+"</div>"
$("body").append(a);
$("div").css({
"top": (e.pageY + y) + "px",
"left": (e.pageX + x) + "px"
}).show("fast")
}).mouseout(function(){
this.title= this.mytitle;
$("div").remove();
});
})
学習の心得:
pラベルの下にdiv要素を追加しないでください.大きな偏差値が現れます.
なるほど!thisと$(「this」)は異なります.
this.title $("this").attr("title")
mouseout title