$(function(){
$('body').on('click', function(e){
if (e.target.tagName != 'A') return;
var $linkTo = $(e.target).attr('href');
var $linkToOffsetTop = $($linkTo).offset().top;
//console.log($linkToOffsetTop);
$('body').stop().animate({scrollTop: $linkToOffsetTop}, 500);
e.preventDefault();
})
})
JChmdW5jdGlvbigpewogICAgICAgICQoJ2JvZHknKS5vbignY2xpY2snLCBmdW5jdGlvbihlKXsKICAgICAgICAgIGlmIChlLnRhcmdldC50YWdOYW1lICE9ICdBJykgcmV0dXJuOwogICAgICAgICAgCiAgICAgICAgICB2YXIgJGxpbmtUbyA9ICQoZS50YXJnZXQpLmF0dHIoJ2hyZWYnKTsKICAgICAgICAgIHZhciAkbGlua1RvT2Zmc2V0VG9wID0gJCgkbGlua1RvKS5vZmZzZXQoKS50b3A7CiAgICAgICAgICAvL2NvbnNvbGUubG9nKCRsaW5rVG9PZmZzZXRUb3ApOwogICAgICAgICAgCiAgICAgICAgICAkKCdib2R5Jykuc3RvcCgpLmFuaW1hdGUoe3Njcm9sbFRvcDogJGxpbmtUb09mZnNldFRvcH0sIDUwMCk7CiAgICAgICAgICAKICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTsKICAgICAgICB9KQogICAgICAgIAogICAgICB9KQ==