0

我有一些 div,当你将鼠标悬停在它们上面时,会出现一些文本。现在在一种情况下,我想将我的 div 从位置 a 移动到位置 b,但我想为它们停用悬停,这意味着当你悬停这个动画 div 时,文本不会出现!

我需要一个条件,如果 div 回到第一个位置,悬停功能再次激活......

你能给我一些建议吗???

$('#wrapper').on('mouseenter', '#p20', function(){

    $('#enroll-en').fadeIn(5).animate({
        marginTop: 150 }, 'fast', false);

    $('#enroll-fa').fadeIn(5).animate({
        marginTop: 120 }, 'fast', false);

    $('#back').fadeIn(5).animate({
        marginTop:90,
        marginLeft:107 }, 'slow', function(){
            $(this).on('click', function() {
                $('img.enroll').removeAttr('style').fadeOut(2);
                $(this).fadeOut(500);

    }); 
  });
});

这段代码是说,当鼠标进入 p20 区域时,enroll-en 和enroll-fa 并返回,将淡入。但是 p20 会在某种情况下移动到另一个位置,并且当您将鼠标悬停在那里时,我需要它,enrollen 和enrollen-fa 并返回,不要出现淡入...请注意问题出在#p20 而不是其他元素...

4

1 回答 1

0

尝试 css 属性pointer-events:none;,它将停止元素上的任何鼠标事件。检查https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events以获取有关此属性的更多信息

于 2013-09-28T19:42:33.463 回答