get CSS rule's percentage value in jQuery -
let's rule follows:
.largefield { width: 65%; }
is there way '65%' somehow, , not pixel value?
thanks.
edit: unfortunately using dom methods unreliable in case, have stylesheet imports other stylesheets, , result cssrules parameter ends either null or undefined value.
this approach, however, work in straightforward cases (one stylesheet, multiple separate stylesheet declarations inside head tag of document).
there's no built-in way, i'm afraid. can this:
var width = ( 100 * parsefloat($('.largefield').css('width')) / parsefloat($('.largefield').parent().css('width')) ) + '%';
Comments
Post a Comment