1

好吧..有点复杂的问题。当您将鼠标悬停在 TR 上时,我会出现一个 DIV。

$(".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 );
    }
);

我试图得到它,以便当您将鼠标悬停在 DIV 上时,它不会消失。有小费吗?

澄清 现在,当您将鼠标悬停在 TD 上时,会出现 DIV。我对其进行了操纵,以便当您将鼠标悬停在 DIV 上时,它会保持不变(曾经消失)。但是现在,当您的鼠标离开 TR 并离开 DIV 时,DIV 不会消失。

4

1 回答 1

2

如果div绝对定位,我相信它是,将它放在tr. 这样,您的鼠标在 div 上也将被视为在 div 上td。这样你的鼠标在divtr不会触发mouseleave

小提琴:

http://jsfiddle.net/mHCNj/1/

于 2011-05-19T14:52:36.327 回答