jQuery幸運大轉盤_jQuery+PHP抽獎程序的簡單實現


jQuery幸運大轉盤_jQuery+PHP抽獎程序的簡單實現



 

在線實例

查看演示

 

完整代碼

<!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>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>jQuery幸運大轉盤_jQuery+PHP抽獎程序(上)</title>
        <style type="text/css">
            .demo{ position:relative;width:417px;}
            #disk{width:417px; height:417px; background:url(/api/jq/5733e347040d9/images/disk.jpg) no-repeat;}
            #start{width:163px; height:320px; position:absolute; top:46px; left:130px;}
            #start img{cursor:pointer}
        </style>
    </head>
    <body>
        <div class="container">
            <div class="demo">
                <div id="disk"></div>
                <div id="start"><img src="/api/jq/5733e347040d9/images/start.png" id="startbtn" alt="轉盤開啟"/></div>
            </div>
        </div>
        <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.7.2/jquery.min.js"></script>
        <script type="text/javascript" src="/api/jq/5733e347040d9/jQueryRotate.2.2.js"></script>
        <script type="text/javascript" src="/api/jq/5733e347040d9/jquery.easing.min.js"></script>
        <script type="text/javascript">
            $(function() {
                $("#startbtn").rotate({
                    bind: {
                        click: function() {
                            var random = Math.floor(Math.random() * 360); //生成隨機數
                            $(this).rotate({
                                duration: 3000, //轉動時間間隔(速度單位ms)
                                angle: 0, //指針開始角度
                                animateTo: 3600 + random, //轉動角度,當轉動角度到達3600+random度時停止轉動。
                                easing: $.easing.easeOutSine, //easing動畫效果
                                callback: function() {  //回調函數
                                    alert('恭喜您,中獎了!');
                                }
                            });
                        }
                    }
                });
            });
        </script>
    </body>
</html>

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM