点击或悬停时淡入和淡出

时间:2013-05-09 19:41:46

标签: onclick fadein fadeout

我有这个脚本:

    $('#tooncart').click(function() {
        $('#top-cart').slideToggle('fast');
        return false;
    });

我需要在#tooncart上悬停,#top-cart需要淡入。 当我从#tooncart移动光标时,#top-cart需要保持可见。 当我再次单击#tooncart并单击某个带有.closing类的div(进入#top-cart)时,它需要再次淡出。

我认为它需要看起来像这样:

    $('#tooncart').hover(function() {
        $('#top-cart').fadeIn('slow');
          // when click on #tooncard or .closing then fade out! 
          // when directly hover on the #tooncart I think it shouldn't be visible.
    });

可能是这样的:

$('。closing')。click(function(){        $(本).parent()淡出();

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

我有这个并且很好:

    $('#tooncart').hover(function() {
        $('#top-cart').fadeIn('slow');
        });
        $('.closing').click(function() {
        $('#top-cart').fadeOut('slow');
    });

点击后即可完美。关闭 #tooncart然后fadeOut!

    $('.closing').click(function() // or #tooncart {
    $('#top-cart').fadeOut('slow');
相关问题