I have a wordpress theme, which has a dynamic element, sized by javascrip(jquery)t on loading of the post (single post, not listing page)
so:
<div class='some-div'>
<div class='content'>
<?php /* code to load posts */ ?>
</div>
At the moment I get the height of div.content with javascript and apply that height to another div.some-div
The problem is on slow connections the height calculations are done before the content has loaded
So, what I need is to run a javascript function ONLY once the post has finished loading
At the moment Im delaying the function, have the script at the footer, and use the ‘defer’ attribute, but I still happens
any ideas?
Just to answer incase anyone has the same issue.
I was running the function before the dom had loaded, a simple mistake easily solved.
use
as a short hand for
$(document).ready