简单的jQuery翻牌效果导航菜单
- - 可咔酷 | 网络杂货铺前几天,有人在Q问那种翻牌效果的广告怎么实现,抽空整了个简单的jQuery翻牌效果的导航菜单,其实说简单也不是很简单,重要的是想好整个过程的思路就好下手了,不整demo了,直接贴代码. 简单的jQuery翻牌效果导航菜单 . 预览效果时左下角会提示错误,而且看不到效果,刷新一下就可以看到效果了.
前几天,有人在Q问那种翻牌效果的广告怎么实现,抽空整了个简单的jQuery翻牌效果的导航菜单,其实说简单也不是很简单,重要的是想好整个过程的思路就好下手了,不整demo了,直接贴代码。
<!DOCTYPE>
<html>
<head>
<title>简单的jQuery翻牌效果导航菜单</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<style type="text/css">
ul, li {
list-style: none;
padding: 0;
margin: 0;
}
#btncell {
width: 300px;
height: 100px;
border: 1px solid #777;
margin: 50px auto;
}
#btncell li {
width: 100px;
float: left;
height: 50px;
font-size: 14px;
text-align: center;
line-height: 28px;
position: relative;
z-index: 1;
}
#btncell li a {
display: block;
height: 28px;
border: 2px solid #333;
text-decoration: none;
width: 50px;
background: #888;
overflow: hidden;
position: absolute;
left: 25px;
top: 10px;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
<script language="javascript">
var nummove = 0;
var numout = 0;
$(function(){
$("#btncell li").hover(function(){
if (nummove == 0) {
nummove = 1;
$("a", this).animate({
height: "0px",
top: "25px"
}, 80, function(){
nummove = 0;
});
$("a", this).animate({
height: "28px",
top: "10px"
}, 80);
$("a", this).css("background", "yellow");
}
}, function(){
if (numout == 0) {
numout = 1;
$("a", this).animate({
height: "0px",
top: "25px"
}, 80, function(){
numout = 0;
});
$("a", this).animate({
height: "28px",
top: "10px"
}, 80);
$("a", this).css("background", "#888");
numout = 0;
}
})
$("#btncell li a").click(function(){
$(this).parents("li").css("z-index", "2")
$(this).animate({
height: "558px",
top: "-255px",
width: "1000px",
left: "-460px",
opacity: 'toggle',
lineHeight: '558px',
fontSize: '500px'
}, 1000);
$(this).animate({
height: "28px",
top: "10px",
width: "50px",
left: "25px",
opacity: 'toggle',
lineHeight: '28px',
fontSize: '12px'
}, 400);
$(this).parents("li").css("z-index", "1")
})
})
</script>
</head>
<body>
预览效果时左下角会提示错误,而且看不到效果,刷新一下就可以看到效果了。
<ul id="btncell">
<li>
<a href="#">1</a>
</li>
<li>
<a href="#">2</a>
</li>
<li>
<a href="#">3</a>
</li>
<li>
<a href="#">4</a>
</li>
<li>
<a href="#">5</a>
</li>
<li>
<a href="#">6</a>
</li>
</ul>
</body>
</html>| 您可能也喜欢: | ||||
在桌面當起老師,翻來翻去的黑板桌 (@mydesy) |
Vespas改賣辦公傢俱?西班牙設計工作室回收改造老舊偉士牌機車 (@mydesy) |
基于jquery仿QQiPhone首页 |
基于CSS & jQuery动画导航条 |
8个很棒的 jQuery 倒计时插件和教程 |
| 无觅 | ||||