window.onload=function(){
waterfall('main','box');
var dataInt={"data":[{"src":'0.jpg'},{"src":'1.jpg'},{"src":'2.jpg'},{"src":'3.jpg'}]};
window.onscroll=function(){
if(checkScrollSlide){
var oParent=document.getElementById('main');
for(var i=0;i<dataInt.data.length;i++){
var oBox=document.createElement('div');
oBox.className='box';
oParent.appendChild(oBox);
oPic.className='pic';
oBox.appendChild(oPic);
var oImg=document.createElement('img');
oImg.src="images/"+dateInt.date[i].src;
oPic.appendChild(oImg);
}
waterfall('main','box');
}
}
}
浏览器提示
Uncaught ReferenceError: oPic is not defined
opic没有创建 (类似oBox,var oBox=document.createElement('div'); )要先创建