2014-01-12 39 views
0

我已经做了放大镜上的动画来移动悬停,但我没有冲突,我不知道为什么它不工作。放大镜与jquery上的动画

http://www.kirstymarks.com/

请参阅下面我的代码: -

$(document).ready(function() { 
$('#ie8 .image-info').css('opacity', '0'); 
    if ($('#ie8 .image-info').length){ 
      $('.entry-image').hover(function(){ 
       $(this).find('.image-info').css('opacity', '1'); 
      }, function(){ 
       $(this).find('.image-info').css('opacity', '0'); 
      }); 
     }; 
}); 
$('.thumbnailwrap .readmore').hover(
      function(){ 
       $(this).find('span').stop(true,true).animate({ 'top' : '-24px', 'opacity' : '0' }, 150, function(){ 
        $(this).css({ 'top' : '86px' }).animate({ 'top' : '9px', 'opacity' : '1' }, 150); 
       }); 
      }, function(){ 
       $(this).find('span').css({ 'top' : '9px', 'opacity' : '1' }).stop(true,true).animate({ 'top' : '46px', 'opacity' : '0' }, 150, function(){ 
        $(this).css({ 'top' : '-24px', 'opacity' : '1' }).animate({ 'top' : '9px' }, 150); 
       }); 
      } 
     ); 

指针是赞赏的家伙,我不想要的答案,我会爱来教育自己如何我已经错以上。

什么,我想重新创建的例子是这样的: -

http://elegantthemes.com/preview/Origin/

+0

尝试把'$(文件).ready'函数内部悬停功能? – Bill

+1

定义“不工作”。 – Blazemonger

+0

在悬停它应该飞起来,并按照CSS函数回来,比利,这将是明智的? –

回答

1

谢谢让康纳在JS聊天的答案。这就是我一直在寻找: -

$(function() { 
$('.readmore').hover(function() { 
    $('span').stop().animate({ 
     top: '-24px', 
     opacity: 0 
    }, 150, function() { 
     $(this).css({ 
      top: '86px' 
     }).animate({ 
      top: '9px', 
      opacity: 1 
     }, 150); 
    });  
}, function() { 
    $(this).find('span').css({ 
     top: '9px', 
     opacity: 1 
    }).stop().animate({ 
     top: '46px', 
     opacity: 0 
    }, 150, function() { 
     $(this).css({ 
      top: '-24px', 
      opacity: 1 
     }).animate({ 
      top: '9px' 
     }, 150); 
    }); 
}); 
}); 

的这个例子: -

http://jsfiddle.net/rusticblonde/T9Gw7/25/

+0

请解释你的答案..你有什么改变? – Bill

+0

嗨比利,这是我正在寻找,它的工作原理。你给我的例子很棒,但它并没有真正向我解释如何对它进行动画处理,上面是我要求的例子 –

+0

但是没有区别..你的代码不工作的原因是因为(*请参阅我的答案*) – Bill

0

hover功能需要在您的$(document).ready函数中。

请参阅我的JsFiddle

我已经做了另一个jsFiddle告诉你同样的事情,但与.animate而不是.css(即使它是完全不相关的问题)。

+0

嗨比利,感谢这一点,我不知道如何将它应用到我自己的示例头脑,因为即时通讯使用动画功能而不是.css。但谢谢你的例子,我会看看我能做些什么:) –

+0

这不是你的动画函数,请参阅[这个小提琴](http://jsfiddle.net/2GntL/3/)的更新版本与动画而不是css。问题是你的整个悬停功能需要在'$(document).ready'里面 – Bill