/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function centre_content(){ var win_height = $(window).height(); var content_height = $('#content').height(); $('#content').css('margin','0 auto'); if ( win_height > content_height ) { $('#content').css({ top : win_height/2 - content_height/2 }); } else { $('#content').css({ top : '10px', }); } } }