Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
このコードをhtml要素で使用するためにしばらく前に見つけました
$("a[href='#top']").click(function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; });
しかし、「t」キーが押されたときにこれをトリガーするにはどうすればよいですか? すべての主要なブラウザの場合?
$(window).keyup(function(e){ if(e.keyCode == 84){ $("html, body").animate({ scrollTop: 0 }, "slow"); } return false; });