Skip to content

Instantly share code, notes, and snippets.

@liwh
Created March 18, 2011 01:58
Show Gist options
  • Select an option

  • Save liwh/875500 to your computer and use it in GitHub Desktop.

Select an option

Save liwh/875500 to your computer and use it in GitHub Desktop.
this.vtip = function() {
this.xOffset = -10;
this.yOffset = 10;
//为class为vtip的增加鼠标移进和移出时间
$(".vtip").unbind().hover(
function(e) {
this.t = this.title;
this.title = '';
//获得显示浮动层的位置
this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
if (this.t != "工作备注:"){
//显示浮动层的内容
$('body').append( '<p id="vtip"><img id="vtipArrow" />' + this.t + '</p>' );
$('p#vtip #vtipArrow').attr("src", 'images/vtip_arrow.png');
$('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");
}
},
function() {
this.title = this.t;
$("p#vtip").fadeOut("slow").remove();
}
).mousemove(
function(e) {
this.top = (e.pageY + yOffset);
this.left = (e.pageX + xOffset);
$("p#vtip").css("top", this.top+"px").css("left", this.left+"px");
}
);
};
jQuery(document).ready(function($){vtip();})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment