jQuery新年年会随机手机号码滚动抽奖代码

jQuery新年年会随机手机号码滚动抽奖代码-精品资源网
jQuery新年年会随机手机号码滚动抽奖代码
此内容为免费资源,请登录后查看
0
免费资源

jQuery新年年会随机手机号码滚动抽奖代码

红色喜庆风格界面jQuery新年年会随机手机号码滚动抽奖代码,2018年会喜迎新年幸运大抽奖活动页面。

js代码

<script type=\"text/javascript\" src=\"js/easing.js\"></script>
<script>

	var u = 100;
	var n = 1;
	var timer; //定义滚动的定时器
	var result   = 18912345678; //指定中奖结果,可以抽取指定数组中的某一个
	var isBegin  = false; //标识能否开始抽奖

	$(\".num\").css(\'backgroundPositionY\',200);//开始13888888888
	$(\".num\").eq(0).css(\'backgroundPositionY\',-100)
	$(\".num\").eq(1).css(\'backgroundPositionY\',-300)

	//执行数字滚动
	function run(){
		n++;
		$(\".num\").each(function(index){
			var _num = $(this);
			_num.animate({
				backgroundPositionY: ((u+1)*n*(index+1))
			},100);

		});
		timer = window.setTimeout(run,100);
		isBegin = true ;
	}
	$(function(){
		//开始抽奖
		$(\'.start\').click(function(){
			if(isBegin){
				return false;
			}else{
				run();
			}
		});
		//停止抽奖
		$(\'.stop\').click(function(){

			var num_arr = (result+\'\').split(\'\');

			$(\".num\").each(function(index){
				var _num = $(this);
				setTimeout(function(){
					_num.animate({
						backgroundPositionY: (u*60) - (u*num_arr[index])
					},{
						duration: 500,
						easing: \"easeInOutCirc\",
						complete: function(){
							if(index == 10){
								isBegin = false;
							}
						}
					});
				},100);
			});
			window.clearTimeout(timer);
			isBegin = false ;
		});
	});
</script>

© 版权声明
THE END
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容