我这里有个自适应屏幕的代码,但当改变页面大小的时候,下面的left和top也都没发生变化
但我用console.log去跟踪了left的值,他的值是可以随屏幕大小发生改变的
window.addEventListener("resize",function(){scrollst();},false);
function scrollst() {
oImg.style.left = Math.ceil((_this.footer.clientWidth / num.length - parseInt(oImg.style.width)) / 2) + "px";
oImg.style.top = _this.settings.NavTop;
console.log(oImg.style.left);
}
scrollst();
给个完整的页面和代码