function divfocus(div){ var target_top = div.offset().top; $('body,html').animate({ 'scrollTop': target_top }); }