Okay.. a bit complicated of a question. I have a DIV that appears when you mouseover a TR.
$(".alignment_tr").hover( function() {
console.log(开发者_开发知识库 "alignmententer" + triggerMouseover );
var tid = $(this).find( ".hidden_inp_selected_alignment" ).val();
var element = $(this);
if( ! element.hasClass( "mouseover-tooltip" ) )
{
$.ajax( {
url: Drupal.settings.jstools.basePath + "?q=search/mouseover_info",
dataType: 'json',
data: { "tid": tid },
success: function( response ) {
$(".mouseover-tooltip .top-level").html( response.genre );
$(".mouseover-tooltip .second-level").html( response.name );
$(".mouseover-tooltip .description").html( response.description );
$(".mouseover-tooltip").css( {
left: element.position().left + ( element.width() * 0.75 ),
top: element.position().top - element.height() / 2,
} );
if( $(".mouseover-tooltip").css( "display" ) == "none" )
{
$(".mouseover-tooltip").fadeIn();
}
}
});
}
},
function() {
console.log( "alignmentleave" + triggerMouseover );
setTimeout( fadeMouseover, 5000 );
}
);
I'm trying to get it so that when you mouse over the DIV, it doesn't just disappear. Any tips?
CLARIFICATION Right now, when you mouseover the TD, the DIV appears. I rigged it so that when you mouseover the DIV, it stays (used to disappear). But now the DIV doesn't disappear when your mouse leaves the TR AND leaves the DIV.
If the div
is absolutely positioned, which I believe it is, place it within the tr
. In that way, your mouse being over the div will count as it being over the td
as well. That way your mouse being over the div
or the tr
will not trigger mouseleave
.
A fiddle:
http://jsfiddle.net/mHCNj/1/
精彩评论