sbortman Posted December 7, 2007 Share Posted December 7, 2007 Dear JavaScript forum folks -I am having difficulty identifying a method whereby I can get the value of a CSS property value for a tag.I would like to get the value of a tag's background-image value (e.g. the url string) forthe purpose of obtaining the image's naturalWidth and naturalHeight. I believe this is possible becausewhen I useMozilla Foxfire's firebug add-on, I can see the image's actual dimentions whenever I hover over the value (url string) of the background property in the style tab pane.Any suggestions?Thanks in advance,Calhoon Link to comment Share on other sites More sharing options...
jesh Posted December 7, 2007 Share Posted December 7, 2007 I responded to your post in the CSS forum before I saw this one here. Take a look at that post. Link to comment Share on other sites More sharing options...
rnd me Posted December 9, 2007 Share Posted December 9, 2007 you will have to create an image element, create an onload function to retrieve the natural size, and then change the source to the url obtained through the css background-image. CSS does not track the natural sizes of background images like the browser does for <img tags>.you might be able to get away with killing the onload function by applying the .src to the url twice. this could guarantee that the image is loaded, Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.