摘要:效果網(wǎng)絡(luò)問(wèn)題上傳不了動(dòng)態(tài)圖片獲得獎(jiǎng)金元元元元提示恭喜你抽到現(xiàn)金紅包關(guān)閉對(duì)話框抽獎(jiǎng)元函數(shù)抽獎(jiǎng)函數(shù)循環(huán)紅包數(shù)量默認(rèn)索引總次數(shù)總?cè)?shù)剩余次數(shù)元
效果(網(wǎng)絡(luò)問(wèn)題上傳不了gif動(dòng)態(tài)圖片)
CSS
.zh-chb-main{position: relative;margin: 0.3rem 0.3rem 0;} .zh-chb-main .zh-center{position: absolute;z-index: 2;left: 50%; top: 1.2rem;width: 3.6rem;height: 2.4rem;margin-left: -1.8rem;font-size: 0.3rem;color: #fff;text-align: center;} .zh-chb-main .zh-center p{padding: 0.7rem 0 0.3rem;} .zh-chb-main .zh-center ul{display: inline-block;} .zh-chb-main .zh-center ul li{float: left;width: 0.8rem;height: 0.8rem;margin-left: -1px;border: 1px solid #FCCE01;font-size: 0.5rem;color: #FCCE01;text-align: center;line-height: 0.8rem;} .zh-chb-main .zh-awards-list{position: relative;width: 6.75rem;height: 5.4rem;margin: 0 auto;} .zh-chb-main .zh-awards-list li{position: absolute;width: 1.35rem;height: 1.35rem;background-color: #F7C29F;box-shadow: 0 0 0 1px #fff;} .zh-chb-main .zh-awards-list .active:before{content: "";display: block;position: absolute;z-index: 2;left: 0;top: 0;width: 100%;height: 100%;border: 2px solid #f00;box-sizing: border-box;} .zh-chb-main .zh-awards-list .zh-hb{width: 1.15rem;height: 1.15rem;margin: 0.1rem 0 0 0.1rem;border-radius: 10px;background-color: #CE1012;} .zh-chb-main .zh-awards-list li:nth-of-type(1){left: 0;top: 0;} .zh-chb-main .zh-awards-list li:nth-of-type(2){left: 1.35rem;top: 0;} .zh-chb-main .zh-awards-list li:nth-of-type(3){left: 2.7rem;top: 0;} .zh-chb-main .zh-awards-list li:nth-of-type(4){left: 4.05rem;top: 0;} .zh-chb-main .zh-awards-list li:nth-of-type(5){left: 5.4rem;top: 0;} .zh-chb-main .zh-awards-list li:nth-of-type(6){left: 5.4rem;top: 1.35rem;} .zh-chb-main .zh-awards-list li:nth-of-type(7){left: 5.4rem;top: 2.7rem;} .zh-chb-main .zh-awards-list li:nth-of-type(8){left: 5.4rem;top: 4.05rem;} .zh-chb-main .zh-awards-list li:nth-of-type(9){left: 4.05rem;top: 4.05rem;} .zh-chb-main .zh-awards-list li:nth-of-type(10){left: 2.7rem;top: 4.05rem;} .zh-chb-main .zh-awards-list li:nth-of-type(11){left: 1.35rem;top: 4.05rem;} .zh-chb-main .zh-awards-list li:nth-of-type(12){left: 0rem;top: 4.05rem;} .zh-chb-main .zh-awards-list li:nth-of-type(13){left: 0rem;top: 2.7rem;} .zh-chb-main .zh-awards-list li:nth-of-type(14){left: 0rem;top: 1.35rem;} .zh-chb-main .zh-awards-list .zh-award-1a{background-image: url(../images/chb/img-chb-1a.png);background-size: 100% auto;background-repeat: no-repeat;background-position: center;} .zh-chb-main .zh-awards-list .zh-award-1b{background-image: url(../images/chb/img-chb-1b.png);background-size: 100% auto;background-repeat: no-repeat;background-position: center;} .zh-chb-main .zh-awards-list .zh-award-2a{background-image: url(../images/chb/img-chb-2a.png);background-size: 100% auto;background-repeat: no-repeat;background-position: center;} .zh-chb-main .zh-awards-list .zh-award-2b{background-image: url(../images/chb/img-chb-2b.png);background-size: 100% auto;background-repeat: no-repeat;background-position: center;} .zh-chb-main .zh-awards-list .zh-award-3a{background-image: url(../images/chb/img-chb-3a.png);background-size: 100% auto;background-repeat: no-repeat;background-position: center;} .zh-chb-main .zh-awards-list .zh-award-3b{background-image: url(../images/chb/img-chb-3b.png);background-size: 100% auto;background-repeat: no-repeat;background-position: center;} .zh-chb-main .zh-awards-list .zh-award-4a{background-image: url(../images/chb/img-chb-4a.png);background-size: 100% auto;background-repeat: no-repeat;background-position: center;} .zh-chb-main .zh-awards-list .zh-award-4b{background-image: url(../images/chb/img-chb-4b.png);background-size: 100% auto;background-repeat: no-repeat;background-position: center;} .zh-chb-main .zh-awards-list .zh-award-5{background-image: url(../images/chb/img-chb-5.png);background-size: 100% auto;background-repeat: no-repeat;background-position: center;} .zh-chb-main .zh-awards-list2{height: 1.75rem;margin-top: 0.5rem;} .zh-chb-main .zh-awards-list2 li {padding-bottom: 0.4rem;font-size: 0.3rem;color: #fff;text-align: center;} .zh-chb-main .zh-awards-list2 li .zh-hb{margin-bottom: 0.05rem;color: #d5190d;} .zh-chb-main .zh-awards-list2 li:nth-of-type(2){left: 1.8rem;} .zh-chb-main .zh-awards-list2 li:nth-of-type(3){left: 3.6rem;} .zh-chb-main .zh-awards-list2 li:nth-of-type(4){left: 5.4rem;} .zh-chb-main .zh-go{display: block;width: 2rem;padding: 0.1rem 0;margin: 0.5rem auto;border-radius: 5px;background-color: #FCCE01;font-size: 0.5rem;color: #fff;text-align: center;}
HTML
恭喜你抽到現(xiàn)金紅包
JS
// 關(guān)閉對(duì)話框 $(".zh-dialog .zh-close").click(function() { $(".zh-dialog").removeClass("active"); }); // 抽獎(jiǎng) $(".zh-go").click(function() { if(!$(this).hasClass("active")) { $(this).addClass("active"); cjFn(this); } }); // 元函數(shù) function yuanFn(type) { switch(type) { case "1a": return "05"; break; case "1b": return "10"; break; case "2a": return "10"; break; case "2b": return "20"; break; case "3a": return "15"; break; case "3b": return "30"; break; case "4a": return "20"; break; case "4b": return "40"; break; case "5": return "00"; break; } } // 抽獎(jiǎng)函數(shù) var prevIndex = 0; function cjFn(goEle) { $("#zh_awards_list li").removeClass("open"); // 循環(huán) var liNum = $("#zh_awards_list li").size(), // 紅包數(shù)量 index = prevIndex, // 默認(rèn)索引 acount = liNum*Math.round(Math.random()*2+1)+Math.round(Math.random()*liNum), // 總次數(shù) allTimes = Math.floor(acount/liNum), // 總?cè)?shù) restTimes = acount%liNum; // 剩余次數(shù) var cjFlag = setInterval(function() { index++; if(allTimes > 0) { if(index==liNum) { index = 0; allTimes--; } } else { if(restTimes==0 || index==restTimes) { var activeEle = $("#zh_awards_list li").eq(index-1), money = yuanFn(activeEle.attr("data-award")); $(".zh-chb-main .zh-center ul li:first").text(money.substr(0,1)); $(".zh-chb-main .zh-center ul li:last").text(money.substr(1,1)); $(".zh-chb-tips .zh-text strong").text((+money)+"元"); $("#zh_chb").addClass("active"); activeEle.addClass("open"); $(goEle).removeClass("active"); clearInterval(cjFlag); } } $("#zh_awards_list li").eq(index-1).addClass("active").siblings().removeClass("active"); prevIndex = index; }, 50); }
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/88262.html
摘要:,大家好,很榮幸有這個(gè)機(jī)會(huì)可以通過(guò)寫(xiě)博文的方式,把這些年在后端開(kāi)發(fā)過(guò)程中總結(jié)沉淀下來(lái)的經(jīng)驗(yàn)和設(shè)計(jì)思路分享出來(lái)模塊化設(shè)計(jì)根據(jù)業(yè)務(wù)場(chǎng)景,將業(yè)務(wù)抽離成獨(dú)立模塊,對(duì)外通過(guò)接口提供服務(wù),減少系統(tǒng)復(fù)雜度和耦合度,實(shí)現(xiàn)可復(fù)用,易維護(hù),易拓展項(xiàng)目中實(shí)踐例子 Hi,大家好,很榮幸有這個(gè)機(jī)會(huì)可以通過(guò)寫(xiě)博文的方式,把這些年在后端開(kāi)發(fā)過(guò)程中總結(jié)沉淀下來(lái)的經(jīng)驗(yàn)和設(shè)計(jì)思路分享出來(lái) 模塊化設(shè)計(jì) 根據(jù)業(yè)務(wù)場(chǎng)景,將業(yè)務(wù)...
摘要:如下圖所示負(fù)載均衡層的限流防止用戶重復(fù)抽獎(jiǎng)首先第一次在負(fù)載均衡層可以做的事情,就是防止重復(fù)抽獎(jiǎng)。然后負(fù)載均衡感知到了之后,后續(xù)請(qǐng)求全部攔截掉返回一個(gè)抽獎(jiǎng)結(jié)束的標(biāo)識(shí)就可以了。一旦抽獎(jiǎng)結(jié)束,抽獎(jiǎng)服務(wù)更新?tīng)顟B(tài),負(fù)載均衡層會(huì)感知到。公眾號(hào):貍貓技術(shù)窩作者:愛(ài)釣魚(yú)的桌子哥,資深架構(gòu)師1、抽獎(jiǎng)系統(tǒng)的背景引入本文給大家分享一個(gè)之前經(jīng)歷過(guò)的抽獎(jiǎng)系統(tǒng)的流量削峰架構(gòu)的設(shè)計(jì)方案。抽獎(jiǎng)、搶紅包、秒殺,這類(lèi)系統(tǒng)其實(shí)都...
摘要:源碼鏈接進(jìn)階持久化插件有同學(xué)可能會(huì)問(wèn),我對(duì)不是很熟悉亦或者覺(jué)得單機(jī)存儲(chǔ)并不是安全,有沒(méi)有支持分布式數(shù)據(jù)存儲(chǔ)的插件呢,比如某爸的云數(shù)據(jù)庫(kù)答案當(dāng)然是有咯,良心的我當(dāng)然是幫你們都找好咯。 這次把這部分內(nèi)容提到現(xiàn)在寫(xiě),是因?yàn)檫@段時(shí)間開(kāi)發(fā)的項(xiàng)目剛好在這一塊遇到了一些難點(diǎn),所以準(zhǔn)備把經(jīng)驗(yàn)分享給大家,我們?cè)谑褂肁kka時(shí),會(huì)經(jīng)常遇到一些存儲(chǔ)Actor內(nèi)部狀態(tài)的場(chǎng)景,在系統(tǒng)正常運(yùn)行的情況下,我們不需要...
摘要:怎么樣是一家注冊(cè)在美國(guó)加州的純外資企業(yè),年開(kāi)始經(jīng)營(yíng)一家專(zhuān)業(yè)的小型虛擬主機(jī)公司,其中包括共享主機(jī),和經(jīng)銷(xiāo)商主機(jī)。此外,對(duì)其主機(jī)具有嚴(yán)格的資源限制。的洛杉磯和英國(guó)的客戶服務(wù)反映出其良好的速度其中云計(jì)算主要經(jīng)營(yíng)香港線路和美國(guó)的三網(wǎng)線路。vmshell怎么樣?vmshell Inc是一家注冊(cè)在美國(guó)加州的純外資企業(yè),Vmshell Inc 2021年開(kāi)始經(jīng)營(yíng)一家專(zhuān)業(yè)的小型虛擬主機(jī)公司,其中包括共享主機(jī)...
閱讀 1332·2021-10-27 14:14
閱讀 3583·2021-09-29 09:34
閱讀 2488·2019-08-30 15:44
閱讀 1733·2019-08-29 17:13
閱讀 2577·2019-08-29 13:07
閱讀 880·2019-08-26 18:26
閱讀 3351·2019-08-26 13:44
閱讀 3217·2019-08-26 13:37