qq_陈翻车鱼_0
2018-12-18 10:50
window.onload=function(){
waterfall('main','box');
}
function waterfall(parent,box){
var oparent =document.getElementById(parent);
var oBoxs = getByClass(oparent,box);
/*列数*/
console.log(oBoxs.length);
}
function getByClass(parent,clsname) {
var boxarr = new [];//存储class是box的元素。
OElements = parent.getElementsByTagName('*');
for (var i = 0; i < OElements.length; i++) {
if (OElements[i].className == clsname) {
boxarr.push(OElements[i]);
}
}
return boxarr;
}
function getByClass(parent,clsname) {
var boxarr = new array(),
OElements = parent.getElementsByTagName('*');
for (var i = 0; i < OElements.length; i++) {
if (OElements[i].className == clsname) {
boxarr.push(OElements[i]);
}
}
return boxarr;
}
瀑布流布局
97759 学习 · 736 问题
相似问题