I have the following function to take the title of a.preview
and append it inside of p#preview
, some AJAX content which is generated on hover. This is a small piece of what's happening overall, but the variable c
in the following script should be the title of a.preview
. For some reason, I'm getting a null response. The title is printing elsewhere so I开发者_如何学Python know that's not the problem, it's either in the variable definition or in the calling of the variable. Any debug suggestions?
$("a.preview").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "<br/>" + this.t : "";
$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview ... Loading' />"+ c +"</p>");
$("#preview")
.hide()
.css("top",(e.pageY - yOffset) + "px")
.css("left",(e.pageX + xOffset) + "px")
.fadeIn("2000");
},
Have a look at this on Fiddle: http://jsfiddle.net/jsNcn/
Looks fine to me?
精彩评论