魅族的“火爆”预定表示“呵呵呵”-不要怪我拆穿

个人对魅族手机也经常关注,觉得设计感比较赞,昨天刚MX4发布完,今天去官网看看,点击预定发现如图:

呵呵,没想到这么“火爆”,细想下点击之后弹窗的速度怎么会这么快,终于细想....不会是....

用firebug查看下网络请求

于是“呵呵呵”拆穿了吧!

看下脚本:

var focusImgTime = null;
var dom = document.getElementById("waitPreorder");
var opacity = document.getElementById("opacity");
var focusImg = document.getElementById("focusImg");
var currentImg = 1;
var isFocusImg = true;
var startFocusImgTime = null;
var startBooking = function() {
	var mobliePreorder = document.getElementById("mobliePreorder");
	mobliePreorder.onclick = function() {
		var r = Math.ceil(Math.random() * 10);
		r > 5 ? getJsonpRequest() : getFocusImg()//这里就是关键的地方了 ,随机一个数字决定你是否直接跳到预定还是弹“火爆“窗体
	}
};
var getJsonpRequest = function() {
	var url = "http://count.booking.meizu.com/count.php?jsonpcallback=getActivityData";
	var script = document.createElement('script');
	script.setAttribute('src', url);
	document.getElementsByTagName('head')[0].appendChild(script)//脚本请求返回结果调用下面getActivityData的方法
};
//处理结果返回预定的跳转地址 var getActivityData = function(data) { if (typeof data[0] != 'undefined' && typeof data[0]['result'] != 'undefined' && data[0]['result'] == '1') { startFocusImgTime = null; window.location.href = data[0]['msg'] } else { isFocusImg && getFocusImg() } };
//弹窗 var getFocusImg = function() { isFocusImg = false; var clientHeight = document.documentElement.clientHeight; var bodyHeight = document.body.clientHeight; dom.style.display = "block"; opacity.style.width = document.documentElement.clientWidth; opacity.style.height = bodyHeight + "px"; focusImg.style.top = (clientHeight - 612) / 2 + "px"; focusImg.style.left = (document.documentElement.clientWidth - 992) / 2 + "px"; startFocusImgTime = setInterval(function() { getJsonpRequest() }, 5000)//倒数5秒后请求跳转 }; startBooking();

 相信大家一目了然了,其实没什么技术含量,虽然只是商家想促销的的手段,只是感觉被欺骗了就不爽了,认真做好产品自然会获得用户!

这里向魅族写官网脚本的同行表示下歉意,因为想你做的更好,所以才会关注!

posted @ 2014-09-03 10:07  itank  阅读(8496)  评论(74编辑  收藏  举报