开发者

How to get css width of class?

My question is, how can i get width parameter开发者_JAVA技巧 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?


The 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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜