Ok, so I'm doing this page: http://www.muzykakoncerty.pl/ . I must dynamic calculate few css attributes to get good effect. The problem is, that if i use $(document).height() then fir开发者_运维问答st time before refresh (every browser?!) elements using $(document).height() are bad-calculated. Check-out yourself. On main page issue is right-centered text "baw się ..." and on another pages is main photo on left side. Just try to refresh page, and u will see difference
any ideas what cause the problem?
EDIT: OK! I know what is issue. Probably browser is loading and getting too late graphics and theirs size (width and height). New question is: How to check if graphics are loaded?
EDIT2: Here is video thats showing the issue: http://www.youtube.com/watch?v=8GCc_S7SdtI
window.onload is not supposed to fire until the images are loaded. You could wait for that particular event. Note that $.ready is not window.onload; it happens before onload. I am not sure if you can bind the onload event with jQuery, but you probably can with the .bind method.
$(window).bind('load', function() {
alert($(document).height());
});
i am not sure what the exact problem is but if you want to get css attribute of a specific object then you can use..offset
var ofset = $('#id').offset();
var hieght = ofset.top;
var left = ofset.left;
hoope this will help you...if i am guessing right.
精彩评论