Created
July 22, 2013 05:16
-
-
Save WenLiangTseng/6051424 to your computer and use it in GitHub Desktop.
把某個彈出DIV放置在滑鼠旁邊
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//You can try: | |
$( "td").click( function(event) { | |
$("#divId").css( {position:"absolute", top:event.pageY, left: event.pageX}); | |
}); | |
//After additional question was asked in the comment: | |
$( "td").click( function(event) { | |
var div = $("#divId"); | |
div.css( { | |
position:"absolute", | |
top:event.pageY, | |
left: event.pageX}); | |
var delayTimer = setTimeout( function( ) { | |
$that.fadeIn( "slow"); | |
}, 100); | |
div.mouseover( function( event) { | |
if (delayTimer) | |
clearTimeout( delayTimer); | |
}).mouseout( function(){ | |
if (delayTimer) | |
clearTimeout( delayTimer); | |
var $that = $(this); | |
delayTimer = setTimeout( function( ) { | |
$that.fadeOut( "slow"); | |
}, 500) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment