<a href="index#top" class="togame"></a>
<script>
$(document).ready(function() {
$('a[href^="#"]').click(function(){
var el = $(this).attr('href');
$('body').animate({
scrollTop: $(el).offset().top}, 1000);
return false;
});
});
</script>
document.body.scrollTop = 0;
var window.scrolled = false;
$(document).one('ready scroll hashchange', function(e) {
if(window.scrolled != false || location.hash.length == 0) return;
e.preventDefault();
var name = location.hash.substr(1);
var el = $('#'+name+', [name='+name+']');
console.log(el);
if(el.size()>0)
{
$('body, html').animate({
scrollTop: el.offset().top
}, 3000);
window.scrolled = true;
}
});