也就是 jquery 里的 width() 的原理, 不包括 margin , padding , border 的宽,仅仅获取 content 的 width 和 heigth.
也就是 jquery 里的 width() 的原理, 不包括 margin , padding , border 的宽,仅仅获取 content 的 width 和 heigth.
|
finianMay 7, 2016
1
看 jQuery 源码呗
|
|
newbieo0OMay 7, 2016
2
学好基本功。多实验就知道了。
|
|
jameMay 7, 2016
3
Element.getBoundingClientRect()
https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect |
|
learnshareMay 7, 2016
4
|
|
5
|
|
6
@jame
@learnshare 要不是试过很多种方法,我不会在 v 站求助的~~~ <img src="http://i2.buimg.com/9890d1546976cdd1.png"> <img src="http://i2.buimg.com/9a6f2e72565ac65d.png"> <img src="http://i2.buimg.com/7e02239c8942d84f.png"> |
|
learnshareMay 7, 2016
7
@maomaomao001 为什么要计算表格单元格的尺寸?
|
|
8
|
|
9
@learnshare 因为,我需要把表格的第一列 一像素不差的 复制到新表格里作为 固定表头。
|
|
10
错了,是第一行!
|
|
learnshareMay 7, 2016
11
|
|
12
|
|
13
|
|
14
|
|
jameMay 8, 2016
15
这东西要跟 box-sizing 合着用的。多看看基础你就会明白了。
https://developer.mozilla.org/zh-CN/docs/Web/CSS/box-sizing |
|
16
@jame 好难啊~~好不容易兼容了 谷歌,ie10 火狐,安卓 和苹果~~~ 没想到微信有个自己的内核又各种不兼容了...
|
|
jameMay 8, 2016
17
如果你用了 viewport ,这东西确实对 positon: fixed 支持不好的
可以试试 position: stricky; see https://developer.mozilla.org/zh-CN/docs/Web/CSS/position 或者去掉 viewport ,使用 hotcss https://github.com/imochen/hotcss |
|
jameMay 8, 2016
18
修正, 目前 viewport 对 fixed 有比较好的支持了,只是 onscroll 不会实时刷新。一般可以使用 touchmove 来代替。但是表现也不是很理想。
|
|
19
@sox 不不不,这个不兼容 火狐浏览器~~~~崩溃了。。。
|