JavaScript 求 JS 和 CSS 大神助,JS 动态改变 top 样式的问题!!!

egg_show · April 10, 2014 · Last by hugeannex replied at September 10, 2014 · 4593 hits
var newClientHeight = document.documentElement.clientHeight;
var newClientWidth = document.documentElement.clientWidth;
$("#div_1,#div_2,#div_3").css({"height": newClientHeight, "width": newClientWidth, "top": (1-type)*newClientHeight});

当窗口大小改变时,用 JS 动态改变 3 个 div 的 3 个样式,3 个 div 的 position 都是 relative 相对定位,为什么在执行上面的 jquery 方法时,前面的 height 和 width 值都改变了,但是 top 值偶尔不会改变,是偶尔!!!我很费解啊!效果是:每个 DIV 铺满整个可见的窗口,滚动鼠标,翻到下一个 DIV,翻下一个 DIV 后改变窗口大小,执行这段代码,top 值偶尔不会改变!!!!!!!(type 是第几个的一个 DIV,1,2,3)

根本不用改变 top,本来就是在对的位置!

You need to Sign in before reply, if you don't have an account, please Sign up first.