首页 > 语言 > JavaScript > 正文

jQuery实现个性翻牌效果导航菜单的方法

2024-05-06 14:44:55
字体:
来源:转载
供稿:网友

本文实例讲述了jQuery实现个性翻牌效果导航菜单的方法。分享给大家供大家参考。具体实现方法如下:

代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery个性翻牌效果的导航菜单</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<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="js/jquery1.3.2.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")

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选