Test Case Boilerplate
Fork this way...
HTML
<div id="divA"><div id="divB">This is a text.</div></div>
CSS
#divA { height:300px; background:red; }
#divB { width:100px; height:100px; background:yellow; position:absolute; }
JavaScript
$(window).unbind("resize.divlayout").bind("resize.divlayout", function() {
console.log('window-resize');
reposition();
}).trigger("resize.divlayout");
function reposition() {
$("#divA").unbind('resize.divlayout').bind('resize.divlayout', function() {
console.log('divA-resize');
//$("#divB").css("top", $("#divA").height() / 2 - $("#divB").height() /2 + "px");
}).trigger('resize.divlayout');
}