I’m trying to dynamically find the width of an item which will have a css class with a specific width, in order to dynamically position its background image (a sprite). However, the item has not yet been added to the DOM. Is there a way to read a class’s width property before it’s added to the DOM?
Share
I believe you cant. Instead add it to a test div,find the width and then remove the div.
selector is the element selector you may want to append to.
You can associate a class with the “test” div, to have it as “display:none”