[code lang=”js”]
window.onload = function() {
function fnAutoLayout() {
var nImgLen = Math.floor(window.innerWidth / 100) – 1;
var nPaddingValue = (window.innerWidth – 100 * nImgLen) / (nImgLen – 1);
var li = document.getElementsByTagName(‘li’);
for(var i = 0, len = li.length; i < len; i++){
li[i].style.paddingRight = nPaddingValue + ‘px’;
}
};
fnAutoLayout();
window.addEventListener(‘resize’, fnAutoLayout);
}
[/code]
暂无评论