2012-04-17 64 views
0

我想要创建悬停一个类似于下面的链接块的flyup JQuery的Flyup效果...同时打开

http://p2power.com/

它只是下面的幻灯片...我如何使用jQuery创建确切的效果?

+0

[你尝试过什么?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – j08691 2012-04-17 16:10:17

+0

我试过效果基本show()函数,但没有发生。然后我知道它隐藏了一切,而不是显示它 – Abilash 2012-04-17 16:13:05

回答

2

这是一个非常基本的例子。你现在可以用CSS3做到这一切,但这里是jQuery的方式。

HTML:

<div class="box"> 
    <div class="inner"> 
     <p>Content</p> 
    </div> 
</div> 

CSS:

.box { 
    position: absolute; 
    bottom: 0; 
    width: 200px; 
    height: 0; 
    overflow: hidden; 
} 

.inner { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
} 

的jQuery:

$('.box').hover(function(){ 
    $(this).animate({ 
     height: 200 
    }); 
},function(){ 
    $(this).animate({ 
     height: 0 
    });   
}); 

您可以测试代码here

这应该做到这一点!

希望帮助:)

+0

但Internet Explorer挣扎与CSS3 ...这就是为什么我去jquery .. – Abilash 2012-04-17 16:14:40

+0

取决于你愿意牺牲。如果你不介意丢失动画,那么在CSS3中会更快,更容易/更快。也就是说,做一些功能检测,如果不支持转换,只应用jQuery。 – will 2012-04-17 16:30:47

+0

我不会为什么,但你的代码不工作的意志。你能建议任何这样做的小部件? – Abilash 2012-04-18 11:04:07