js实现夹娃娃游戏

代码语言:html

所属分类:游戏

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <title>夹娃娃抽奖</title>
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">

    <style type="text/css">
        * {
            margin: 0px;
            border: 0px;
            padding: 0px;
        }
        #wrapper {
            width: 750px;
            height: 1109px;
            margin: 0 auto;
            background-image: url('http://repo.bfw.wiki/bfwrepo/image/jiawawa/bg.png');
            position: relative;
            z-index: 1;
        }
        #rod {
            position: relative;
            top: 235px;
            left: -20px;
            width: 16px;
            height: 3px;
            margin: 0 auto;
            background-image: url(http://repo.bfw.wiki/bfwrepo/image/jiawawa/rod.png);
            background-repeat: repeat-y;
        }
        #hand {
            /*
			width: 124px;
			height: 83px;
			*/
            width: 150px;
            height: 83px;
            position: relative;
            top: 235px;
            left: -20px;
            background-position: 158px 0px;
            background-image: url(http://repo.bfw.wiki/bfwrepo/image/jiawawa/hand.png);
            margin: 0 auto;
        }

        #babys {
            height: 200px;
            width: 500px;
            margin: 0 auto;
            overflow: hidden;
            position: relative;
            top: -550px;
            left: -20px;
        }

        #uptoy {
            width: 200px;
            height: 200px;
            margin: 0 auto;
            position: relative;
            z-index: 3;
            top: -750px;
            left: -20px;
            display: none;
        }

        #start_btn {
            width: 123px;
            height: 115px;
            background-image: url('http://repo.bfw.wiki/bfwrepo/image/jiawawa/start.png');
            background-position: -40px -20px;
            position: absolute;
            top: 790px;
            left: 1050px;
            z-index: 4;
            border: none;
            outline: none;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div id="wrapper">
        <div id="rod"></div>
        <div id="hand"></div>
    </div>
    <div id="babys">

    </div>
    <div id="uptoy">
        <img src="images/toy117.png">
    </div>
    <div id="start_btn">
    </div>
    <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/jquery.17.js"></script>
    <script type="text/javascript">
        var toys = new Array(); //娃娃数组
        var flag = true; //按钮默认可以点击
        $("#start_btn").click(function() {
            if (!flag) {
                alert("不要连续点击,等夹完一次再夹");
                return;
            }
            flag = false; //刚刚被点击完,按钮不能连续点击
            //改变按钮的位置
            $("#start_btn").css({
                "backgroundPosition": "-40px -160px"
            });
            //动画将绳子往下移动到200像素
            $("#rod").animate({
        .........完整代码请登录后点击上方下载按钮下载查看

网友评论0