Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb7e2fbf

Browse files
committed
add smooth scroll
1 parent389efc6 commitb7e2fbf

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

‎_includes/scripts.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<scriptsrc="{{" /js/modals.min.js " | prepend: site.baseurl }}"></script>
1212
<scriptsrc="{{" /js/lib/png2gif.min.js " | prepend: site.baseurl }}"></script>
1313
<scriptsrc="{{" /js/lib/jquery.lazyload.min.js " | prepend: site.baseurl }}"></script>
14+
<scriptsrc="{{" /js/lib/jquery.smoothscroll.min.js " | prepend: site.baseurl }}"></script>
1415
<script>!function(e,t,a,n,c,s,o){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*newDate,s=t.createElement(a),o=t.getElementsByTagName(a)[0],s.async=1,s.src=n,o.parentNode.insertBefore(s,o)}(window,document,"script","https://www.google-analytics.com/analytics.js","ga"),ga("create","UA-44377274-8","auto"),ga("send","pageview");
1516
</script>

‎_includes/table-of-contents.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<ahref="#{{ include.link }}">
1+
<ahref="#{{ include.link }}"class="smooth">
22
<h5>{{include.index}}. {{ include.title }}</h5>
33
</a>

‎js/lib/jquery.smoothscroll.min.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎js/modals.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ $(function() {
2424
});
2525

2626
// smooth scroll
27-
$('a[href*="#"]:not([href="#"])').click(function(){
28-
if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')&&location.hostname==this.hostname){
29-
vartarget=$(this.hash);
30-
target=target.length ?target :$('[name='+this.hash.slice(1)+']');
31-
if(target.length){
32-
$('html, body').animate({
33-
scrollTop:target.offset().top
34-
},1000);
35-
returnfalse;
36-
}
37-
}
27+
$('a.smooth').smoothScroll({
28+
offset:-70,
29+
direction:'top',
30+
easing:'swing',
31+
speed:400,
32+
autoCoefficient:2,
33+
preventDefault:true
3834
});
3935

4036
});

‎js/modals.min.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp