You can type the following jquery code:
$(document).ready(function() {
$(document).bind('keydown',function(event){
if(event.keyCode == 38){
$("html, body").animate({scrollTop: $("#g").offset().top}, 1000);
}
});
});
OR you can build your own plugin, to use it everywhere you want:
create a file and rename it to jquery.goto.js , then type:
(function($) {
$.fn.goTo = function() {
$('html, body').animate({
scrollTop: $(this).offset().top + 'px'
}, 'fast');
return this; // for chaining...
}
})(jQuery);
Now to use your plugin include it to your page
<script src="js/jquery.goto.js"></script>
to scroll to some element:
$('#g').goTo();
That's it, Good luck