0712-2888027 189-8648-0214
微信公眾號(hào)

孝感風(fēng)信網(wǎng)絡(luò)科技有限公司微信公眾號(hào)

當(dāng)前位置:主頁(yè) > 技術(shù)支持 > Javascript/JQuery > JQuery周年慶砸金蛋、活動(dòng)期間每次刷新頁(yè)面都會(huì)出現(xiàn)、直到砸過(guò)的代碼片段

JQuery周年慶砸金蛋、活動(dòng)期間每次刷新頁(yè)面都會(huì)出現(xiàn)、直到砸過(guò)的代碼片段

時(shí)間:2024-09-20來(lái)源:風(fēng)信官網(wǎng) 點(diǎn)擊: 672次
以下為風(fēng)信建站項(xiàng)目開(kāi)發(fā)中所使用的JQuery用戶(hù)提交登記信息進(jìn)行驗(yàn)證的代碼片段,分享給大家使用。
//彈出大雞蛋
function showZnq2() {
	$("#znq2").remove();
	var showZnqHtml = "<div id='znq_cont'>" +
	"<div id='smash_egg' onclick='smashEgg()'><img id='hammer' src='/images/wx_active/znq2/cz.png' /></div>" +
			"</div>";
	var $vexContent = vex.open({
        content: showZnqHtml,
        contentCSS: {'background-color': 'transparent', 'width': '890px', 'height': '660px'},
        closeClassName: "znq_close"
    });
    $vexContent.find('.close').on('click', function() {
        if ($vexContent.data().vex) {
            vex.close($vexContent.data().vex.id);
        } else {
            vex.close();
        }
    });
}
//點(diǎn)擊砸蛋蛋
function smashEgg() {
	//$("#smash_egg").addClass("egg_open");
	
	//$(".hammer").css({"top":_this.position().top-55,"left":_this.position().left+185});
	var _this = $("#hammer");
	$("#hammer").animate({
		"top":_this.position().top+325,
		"left":_this.position().left-225,
		}, 100,function(){
			$("#smash_egg").addClass("egg_open");
		}
	);
}
function closeShowEgg() {
	$("#znq2").remove();
}
window.smashEgg = smashEgg;
window.showZnq2 = showZnq2;
window.closeShowEgg = closeShowEgg;
//2周年慶砸金蛋 活動(dòng)期間每次刷新頁(yè)面都會(huì)出現(xiàn)  直到砸過(guò)
var mydate = new Date();
var tday = mydate.getFullYear()+"-"+(mydate.getMonth()+1)+"-"+mydate.getDate();
var znq_layer_day = "2017-10-21";
var znq_jd_start_day = "2017-10-19";
var znq_jd_end_day = "2017-10-25";
if(tday >= znq_jd_start_day && tday <= znq_jd_end_day){
        if(!window.ismobile){//pc
        	if($.cookie('znq2_layer_ck')!=1 && tday==znq_layer_day){//會(huì)顯示彈窗-不顯示金蛋
        	}else{
	        	if($.cookie('znq2_ck')!=1 
	        			&& (typeof(window.second_year_view)=="undefined" || !window.second_year_view)
	        			&& (typeof(window.pc_index_view)=="undefined" || !window.pc_index_view)
	        			){//cookie只訪(fǎng)問(wèn)一次
			        setTimeout(function() {
			        	$.cookie('znq2_ck', 1); 
			        	var znq_class = Math.floor(Math.random()*4+1);
			        	var znq2_html = "<div id='znq2' class='znq2_fix_"+znq_class+"'><div class='znq_egg_close' onclick='closeShowEgg()'></div><img onclick='showZnq2()' src='/images/wx_active/znq2/fixed.png' /></div>";
			            $body.append(znq2_html);
			        }, 1000);
	        	}
        	}
        }else{//手機(jī)
        	if(typeof(window.is_wx_znq2)=="undefined" || !window.is_wx_znq2){
	        	if($.cookie('znq2_mobile_ck')!=1){//cookie只訪(fǎng)問(wèn)一次
	        		setTimeout(function() {
			        	$.cookie('znq2_mobile_ck', 1); 
	        			var $znq2_mobile = vex.open({
	    					content: "<img style='margin-top:30px;' src='/images/wx_active/znq2/mobile_oe2.png' />",
	    					contentCSS: {'background-color': 'transparent', 'left':0, 'right':0, 'margin': '0 auto', 'padding':0, 'top':'100px'},
	    					overlayCSS: {'background': 'rgba(0, 0, 0, 0.7)'},
	    					css: {'z-index': 99999}
	    				});
	        			$znq2_mobile.find('.close').on('click', function() {
	    			        if ($znq2_mobile.data().vex) {
	    			            vex.close($znq2_mobile.data().vex.id);
	    			        } else {
	    			            vex.close();
	    			        }
	    			    });
			        }, 1000);
	        	}
        	}
        }
}
熱門(mén)關(guān)鍵詞: JQuery 周年慶 砸金蛋 活動(dòng)期間

您可能感興趣的相關(guān)文章:

欄目列表
推薦內(nèi)容
熱點(diǎn)內(nèi)容
展開(kāi)
  • <code id="kqnen"><tr id="kqnen"><output id="kqnen"></output></tr></code>