Convert CSS rule to JavaScript property -
is there quick way or predefined javascript method converts
"text-align" "-webkit-transform" "position" "background-image"
into
"textalign" "webkittransform" "position" "backgroundimage"
with vanilla javascript (no jquery, ect)?
use regex replace:
"text-align".replace(/-([a-z])/g,function(m,l,i){return i?l.touppercase():l})
it matches hyphen , letter. replace returns letter, capitalized if index truthy (not 0).
javascript css
No comments:
Post a Comment