Is it possible to use jQuery to get the width of an element in percent or pixels, based on what the developer specified with CSS? -
i'm writing jquery plugin , need able determine width of element user specifies. problem .width() or .css('width') study exact pixels, if developer has assigned e.g. width:90% css.
is there way have jquery output width of element in px or % depending on developer has given css?
i'd best way compute yourself:
var width = $('#someelt').width(); var parentwidth = $('#someelt').offsetparent().width(); var percent = 100*width/parentwidth; jquery css width
No comments:
Post a Comment