Find the “potential” width of a hidden element

前端 未结 10 1360
慢半拍i
慢半拍i 2020-12-03 09:31

I\'m currently extending the lavalamp plugin to work on dropdown menus but I\'ve encountered a small problem. I need to know the offsetWidth of an element that

10条回答
  •  孤街浪徒
    2020-12-03 10:09

    The only thing I can think of is to show it (or a clone of it) to allow retrieval of the offsetWidth.

    For this measurement step, just make its position absolute and its x or y value a big negative, so it will render but not be visible to the user.

提交回复
热议问题