Skip to content

Instantly share code, notes, and snippets.

@yuuan
Created November 13, 2013 06:18
Show Gist options
  • Select an option

  • Save yuuan/7444549 to your computer and use it in GitHub Desktop.

Select an option

Save yuuan/7444549 to your computer and use it in GitHub Desktop.
(function($) {
var isInternetExplorer = (-1 != navigator.userAgent.indexOf("MSIE"));
if (!isInternetExplorer) {
this.xOffset = -10; // x distance from mouse
this.yOffset = 28; // y distance from mouse
$(".vtip").unbind().hover(
function(e) {
this.t = this.title;
this.title = '';~
this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
$('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);
@yuuan
Copy link
Author

yuuan commented Nov 13, 2013

IE 除外しなくてもよさそう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment