I am using a small JavaScript snippet to align the bottom edge with a small sidebar section ("Hot Right Now") with the bottom edge of the Featured Image section on a website I'm working on.
The script kicks in only once the entire p[age has loaded, and as a result, the section I'm trying to align jumps a bit. How should I modify the script to align it right away?
Here's the snippet I'm using:
<script type="text/javascript">
$( document ).ready(function() {
var leftheight = $(".featured-image a img").offset().top + $(".featured-image a img").height();
var rightheight = $('#top-posts-2').offset().top + $('#top-posts-2').height();
var heightgap = leftheight - rightheight;
$('#top-posts-2').css('padding-top', parseInt(heightgap + 3, 10) + 'px');
});
</script>
$(document).ready(...)does?$(document).ready(), actually...