Mobile phone turntable lottery code sharing _ javascript skills

Source: Internet
Author: User
There is also a saying that the lottery turntable is generally set by a circle panel with many awards. in front of the circle panel, there is also a pointer that is fixed. below, I will share with you the mobile phone turntable lottery. if you need it, you can refer to the following demo:

I am not talking nonsense. I am posting code directly to you.

Html section

Css part. because the turntable is made on the mobile phone end, the response layout is adopted.

.turntableWap{ padding:1rem; background:url(../images/zpTabBg.jpg) no-repeat center; background-size:100% 100%;}.turntableWap table{ width:100%;}.turntableWap table td{ vertical-align:middle; text-align:center; background-color:#ecd295;}.turntableWap table td img{ width:100%; }.turntableWap table td.even{background-color:#f6e8c5}.turntableWap table td.active{ background-color:#ed9351;}

Js section

$ (". TurntableWap. table "detail .css ({" height ": $ (". turntableWap. table "). width ()}); // Make a responsive layout. the outer table is var isdo = true; $ (". zpBtn "). on ("click", function () {var num = 13; // The Prize var rotaNum = 14 in the background; // The number of prizes var count =-1; // highlight, rotation effect var jishi = 0; // Time range var speed = 50; // fast speed var speedSlow = 200; // slow speed choujiang () // call the Lottery method. choujiang () is called for judgment, and the function choujiang () {if (isdo) {isdo = false; $ (". turntableWap ").css ({" background-image ":" url (.. /images/1.gif) "}) var c = setInterval (function () {if (count> 12) {count =-1;} count = count + 1; jishi = jishi + 1; $ (". turntableWap td "). removeClass ("active"); $ (". turntableWap td [tag = "+ count +"] "). addClass ("active"); if (jishi> rotaNum * 2) {clearInterval (c); c = setInterval (function () {count = count + 1; jishi = jishi + 1; $ (". turntableWap td "). removeClass ("active"); $ (". turntableWap td [tag = "+ count +"] "). addClass ("active"); if (jishi> num + rotaNum * 2) {clearInterval (c); $ (". turntableWap ").css ({" background-image ":" url (.. /images/zpTabBg.jpg) "}) isdo = true; var jp = $ (". turntableWap td [tag = "+ count +"] "). find ("img "). attr ("alt") alert ("Congratulations! Get It" + jp) }}, speedSlow) }}, speed)} else {return ;}}})

The above is the code for the mobile phone turntable lottery, which we will share with you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.