Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我运行以下代码时:
node = $('.period') alert(node.width() + ' ' + node.css('width'))
我得到'0 144px'。这怎么可能?
也许你在 $(document).ready 上调用它,并且 as width() 获取当前计算的第一个匹配元素的像素宽度。,它将为 0,因为它还没有被渲染... css('width')但是从 css 样式表中读取,它已经可用。