Asked this question earlier today, but I think I awarded a correct answer too early. I'm trying to figure out how to grab the css length and width of an anchor element with jquery in Safari. But I keep getting "0" returned, and I was told that this was because the javascript is firing before the css is rendered - a quirk of Webkit browsers.
Here is the original page: http://f1shw1ck.com/jquery_sandbox/csspops-orig.html
However, I wrote a little test, telling jquery to wait until everything is completely rendered before grabbing the css. http://f1shw1ck.com/jquery_sandbox/csspops.html
For selector
a.popup {
width: 800px;
height: 560px;
}
and html
<a href="http://www.metmuseum.org/toah/hd/apol/hd_apol.htm" class="popup">African Rock Art: Apollo 11 Cave Stone (c. 25,500 - 23,500 BCE); Wonderwerk Cave Stones (c. 8000 BCE)</a>
wait until the page is completely, then get those dimensions:
$(document).ready(function () {
if (jQuery.browser.safari && document.readyState != "complete"){
//console.info('ready...');
setTimeout( arguments.callee, 5000 );
return;
}
alert($("a.popup").css("width"));
});
Except "0" is still getting returned in Safari. Am I going about this the wrong way, or is there some other cause at play?
Thanks!