The problem is simple. How do I get a div's background image size (width and height) in jQuery. Is it even possible? I thought this would work:
jQuery('#myDiv').css('background-image').height();
The error message I get is that this is not a function.
The following is my adaptation:
Usage:
Here is my rendition.
Usage:
Its been a while but I needed this solution as well, based on some suggested solutions here is my complete solution.
Another short way :
usage
https://jsfiddle.net/x4u2ndha/58/
Late answer, but you could also do this:
Then you don't have to manipulate the dom objects;
css('background-image') will return "url(.....)", you can't test the height of the image with that, since it's not a DOM object.