当鼠标离开项目时,如何正确隐藏文本?

时间:2015-07-14 10:42:38

标签: jquery html

我有这个网站:

link

当用户将鼠标悬停在(...)上时必须显示为文本。当没有超过该项时,应该消失文本。

我尝试使用此代码,但无法正常工作。

没错,除非你带上屏幕箭头的某些部分。

代码JQuery:

jQuery(document).ready(function($) {

    $(".ascunde").hide();

        $('.plus').hover(function(){
           $(".ascunde").show(500);
            $(".plus").hide(500);


       });

        $('.page-id-1675 section .container').hover(function(){
           $(".ascunde").hide(500);
          $(".plus").show(500);


       });
         $('.gigi').click(function(){
            $(".ascunde2").show();
            $(".plus2").hide();
          });

        $('.plus2').hover(function(){
            $(".ascunde2").show(500);
            $(".plus2").hide(500);


       });

        $('.page-id-1675 section .container').hover(function(){
            $(".ascunde2").hide(500);
            $(".plus2").show(500);

       });



});

你能告诉我问题是什么,什么不能正常工作?

提前致谢!

1 个答案:

答案 0 :(得分:2)

你想要这样的东西吗?

$('.plus').hover(function(){
    $('.plus').hide();
    $(this).parent().next().show();
},
function(){                  
    $('.plus').show();
    $(this).parent().next().hide();   
});

http://jsfiddle.net/wa7ywxL0/2/

相关问题