admin管理员组文章数量:1287891
My question is, how can i get width parameter of class css style?
For example i have <div class="page css-1" id="page1">
div with id=page and classes "page" and "css-1". I want to get width parameter of css-1 class style?
My question is, how can i get width parameter of class css style?
For example i have <div class="page css-1" id="page1">
div with id=page and classes "page" and "css-1". I want to get width parameter of css-1 class style?
- 1 possible duplicate of get style.width when property set with className – Shakti Singh Commented Apr 30, 2011 at 12:16
1 Answer
Reset to default 10The easiest way is probably to ignore that <div>
, create a new one with the class you care about and check its style attributes. You need to add it to the DOM for it to adopt the CSS of the document.
var div = $('<div>').addClass('css-1').hide();
$('body').append(div);
var width = div.css('width');
div.remove();
本文标签: javascriptHow to get css width of classStack Overflow
版权声明:本文标题:javascript - How to get css width of class? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741320081a2372152.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论