第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

圖片只能翻轉(zhuǎn)一次,然后再怎么點(diǎn)都不動(dòng)了

//3.通用函數(shù)
function?g(selector)?{
	var?mothod?=?selector.substr(0,?1)?==?'.'???'getElementsByClassName'?:?'getElementById';
	return?document[mothod](selector.substr(1));
}

//隨機(jī)生成一個(gè)值,z支持取值范圍
function?random(range){
	var?max?=?Math.max(range[0],range[1]);
	var?min?=?Math.min(range[0],range[1]);
	var?diff?=?max-min;
	var?number?=?Math.random()?*?diff?*?min;
}

//4.輸出所有的海報(bào)
var?data?=?data;

function?addPhotos()?{

	var?template?=?g('#warp').innerHTML;
	var?html?=?[];

	for(s?in?data)?{

		var?_html?=?template
			.replace('{{index}}',?s)
			.replace('{{img}}',?data[s].img)
			.replace('{{caotion}}',?data[s].caption)
			.replace('{{desc}}',?data[s].desc);
		html.push(_html);

	}

	g('#warp').innerHTML?=?html.join('');
	rsort(random([0,data.length]));
}
addPhotos();
//6.計(jì)算左右分區(qū)的范圍
function?range(){
	var?range?=?{?left:{?x:{},?y:{}?}?,?right:{?x:{},?y:{}?}?};
	var?wrap??=?{
		w:g('#warp').clientWidth,
		h:g('#warp').clientHeight
	}
	var?photo?=?{
		w:g('.photo')[0].clientWidth,
		h:g('.photo')[0].clientHeight
	}
	range.wrap?=?wrap;
	range.photo?=?photo;
	
	range.left.x?=?[0-photo.w,?wrap.w/2-photo.w/2];
	range.left.y?=?[0-photo.h,?wrap.h];
	
	range.right.x?=?[wrap.w/2?+?photo.w/2,?wrap.w?+?photo.w];
	range.right.y??=?range.left.y;
	return?range;
}

//5.排序海報(bào)
function?rsort(n){
	var?_photo?=?g('.photo');
	var?photos?=?[];
	for?(s=0;?s<_photo.length;s++)?{
		
		_photo[s].className?=?_photo[s].className.replace(/\s*photo_center\s*/,'')
		photos.push(_photo[s]);
	}
	
	var?photo_center?=?g('#photo_'+n);
	photo_center.className+='photo_center?';
	photo_center?=?photos.splice(n,1)[0];
	//分為左右區(qū)域
	var?photos_left?=?photos.splice(0,Math.ceil(photos.length/2?))
	var?photos_right?=?photos;
	
	var?ranges?=?range();
	for?(s?in?photos_left)?{
		var?photo?=?photos_left[s];
		
		photo.style.left?=?random(ranges.left.x)?+?'px';
		photo.style.top?=random(ranges.left.y)+?'px';
	}
	
	for?(s?in?photos_right)?{
		var?photo?=?photos_right[s];
		photo.style.left?=?random(ranges.right.x)?+?'px';
		photo.style.top?=random(ranges.right.y)+?'px';
	}
	
	//console.log(photos.length);
}

//1.翻面控制
function?turn(elem)?{
	var?cls?=?elem.className;
	if(/photo_front/.test(cls))?{
		cls?=?cls.replace(/photo_front/,?'photo_back');
	}?else?{
		cls?=?cls.replace(/photo_back'/,?'photo_front');
	}
	return?elem.className?=?cls;
}

只能翻轉(zhuǎn)一次咋整

正在回答

1 回答

傳代碼呀~

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

圖片只能翻轉(zhuǎn)一次,然后再怎么點(diǎn)都不動(dòng)了

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)