0

I want to get the displayed dimensions of a CSS background-image when it is resized using CSS3 background-size property.

The web is filled with solutions to get the native/original width or height like this one - How do I get background image size in jQuery?

I know that I can get the value of background size with .css('background-size') and use regex to extract the width and height but that does not work if cover, percentage values or auto is used.

Community
  • 1
  • 1
A.Jesin
  • 423
  • 3
  • 18
  • can you provide any link of this page. – Dheeraj Feb 27 '14 at 07:41
  • Can't you just use the dimensions of the container of the background? Or do you want to know the dimensions of the visible image + whats possible cropped? – Nico O Feb 27 '14 at 07:59
  • @A.Jesin i think your comment got cropped? ;) – Nico O Feb 27 '14 at 10:02
  • 1
    @NicoO Sometimes the background image is resized smaller than the container and sometimes it is resized to a larger size. I want to know the **rendered** size of the background image. A simple code is available here - http://jsfiddle.net/jesin/gC77n/ – A.Jesin Feb 27 '14 at 10:09
  • Have you seen this discussion? http://stackoverflow.com/questions/5106243/how-do-i-get-background-image-size-in-jquery – TimSPQR Feb 27 '14 at 11:24
  • @TimSPQR That discussion shows how to get the __original__ dimensions, what I want is the size of the background image resized using `background-size` – A.Jesin Feb 27 '14 at 11:52

0 Answers0