My j开发者_C百科Query code:
$('.box_class').bind('mouseover', function(e){
$('.tooltip').css({'top':e.pageY,'left':e.pageX, 'z-index':'1'});
$('.tooltip').fadeIn("fast");
});
It works fine, but I want that message would always follow the mouse pointer and now, when I "mouseover" on box_class
it always stays at the same point. I probably should change mouseover
function to another? Or how should I implement that?
Try mousemove:
$('.box_class').bind('mouseover', function(e){
$('.tooltip').fadeIn("fast");
});
$('.box_class').bind('mousemove', function(e){
$('.tooltip').css({'top':e.pageY,'left':e.pageX, 'z-index':'1'});
});
Keep your mouseout
or mouseleave
observer to close the tooltip.
Is the position set to absolute? If not try:
position:absolute;
精彩评论