Skip to content

Instantly share code, notes, and snippets.

@three-inc
Created July 3, 2018 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save three-inc/0adef5c82416277f54b909244dda5345 to your computer and use it in GitHub Desktop.
Save three-inc/0adef5c82416277f54b909244dda5345 to your computer and use it in GitHub Desktop.
スムーススクロール
$(function(){
$('a[href^="#"]').click(function(){
var speed = 500;
var href= $(this).attr("href");
var target = $(href == "#" || href == "" ? 'html' : href);
var position = target.offset().top;
$("html, body").animate({scrollTop:position}, speed, "swing");
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment