offsetwidth, JS的整數(shù)計算會出錯嗎?
和老師一樣的代碼,為什么我的console.log(oBoxW)顯示的201,然后oParent.style.cssText='width:'+oBoxW*cols+'px;margin:0 auto';只顯示5列。
而我將.pic的border 從1改成2之后console.log(oBoxW)顯示為204,oParent.style.cssText='width:'+oBoxW*cols+'px;margin:0 auto'可以顯示6列了??
為什么會出現(xiàn)這種情況???
2016-06-15
應該是 math floor 取整的問題 最好不要改動邊框 ?你改下padding值看看 應該也是會顯示6行