实例介绍
【实例简介】
【实例截图】
【核心代码】
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="微信转盘、有奖转盘" /> <meta name="description" content="医学论坛网" /> <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'/> <meta name=”format-detection” content=”telephone=no” /><!--禁用iphone自动将数字串转化为电话--> <meta http-equiv="X-UA-Compatible" content="IE=8"> <title>幸运大转盘-jQuery PHP实现的抽奖程序</title> <link rel="stylesheet" type="text/css" href="../css/main.css" /> <style type="text/css"> .demo{width:100%; position:relative} #disk{width:70%; height:auto;margin:0px auto;display: block;} .start{width:30%; height:auto; display:block;position:absolute;top:8%; margin-left:35.5%;} </style> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="jQueryRotate.2.2.js"></script> <script type="text/javascript" src="jquery.easing.min.js"></script> <script type="text/javascript"> $(function(){ $("#startbtn").click(function(){ lottery(); }); }); function lottery(){ $.ajax({ type: 'POST', url: 'json.php', dataType: 'json', cache: false, error: function(){ alert('出错了!'); return false; }, success:function(json){ $("#startbtn").unbind('click').css("cursor","default"); var a = json.angle; //角度 var p = json.prize; //奖项 $("#startbtn").rotate({ duration:3000, //转动时间 angle: 0, animateTo:1800 a, //转动角度 easing: $.easing.easeOutSine, callback: function(){ var con = confirm('恭喜你,中得' p '\n还要再来一次吗?'); if(con){ lottery(); }else{ return false; } } }); } }); } </script> </head> <body> <div class="demo"> <img id="disk" src="disk.jpg" /> <img src="start.png" id="startbtn" class="start"> </div> </body> </html>
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
网友评论
我要评论