Determine whether element has fixed or percentage width using JavaScript

前端 未结 5 429
情话喂你
情话喂你 2020-12-18 08:24

Using Mootools Element.Dimensions I can get the computed size, in pixels, of any element. However, I can find no way of telling whether an element has been sized using pixel

5条回答
  •  再見小時候
    2020-12-18 08:39

    I doubt it can be done. You described the reason quite accurately: We have access to this kind of information only if it is in the element's style attribute. The only way I can think of is enlarge the parent container a bit and see if the textarea grows proportionately in size, but this is probably not always feasible, and probably hard to make cross-browser functional.

    I'd be highly interested in more positive answers, though.

提交回复
热议问题