I have created a script to keep a div centred on the screen. It works fine in safari but for some reason jumps on window resize. I assume is is doubling the negative 'margin-top'. Anyone have any experience with this. I havent tried in chrome or ie.
// PART B
function cent() {
var $block = $("#block"),
margintop = parseInt($block.height() / -2);
console.log('called');
$('#block').css("margin-top", margintop);
};
$(document).ready(function(){
cent();
});
$(window).resize(function(){
cent();
});
the site url: www.thebackroads.com.au