When reading width of DIV section, the result comes in %. But, I want to convert it in pixel value. How is it possible ?
I have a class “h” defined in my html. It has width=”100%”. It’s parent div has width=”69%”.
width = ($(this).find('.h').width())
So actually the width is not window.width() but it is 69% of it. I want it in pixel !!!
Instead of reading the css use
.width(), in the case the div isn’t visible (which appears to be the case from your previous answer), show it get the width and hide it, like this:since the UI thread won’t update until this is done…the user won’t see it. Make sure
.width()is what you’re after though (e.g. do you want margins or not?) There are other dimension methods if you do/don’t want padding/margins, you can find them here.