File tree Expand file tree Collapse file tree 8 files changed +15
-11
lines changed
Expand file tree Collapse file tree 8 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 11< div class ="back-to-top ">
2- < a href ="# ">
2+ < a href ="#top " class =" scroll ">
33 < i class ="fa fa-arrow-up " aria-hidden ="true "> </ i >
44 </ a >
55</ div >
Original file line number Diff line number Diff line change 1- < header >
1+ < header id =" top " >
22 < div class ="wrapper ">
33 < a href ="{{ site.baseurl }}/ " class ="brand "> {{ site.title }}</ a >
44 < small > {{site.brief-intro}}</ small >
Original file line number Diff line number Diff line change 1212 {% include footer.html %}
1313 {% include backToTop.html %}
1414 < script src ="{{ " /js/main.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
15+ < script src ="{{ " /js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
1516 </ body >
1617
1718</ html >
Original file line number Diff line number Diff line change @@ -97,5 +97,4 @@ <h2 id="comments">Comments</h2>
9797 }
9898} ( ) ) ;
9999</ script >
100- < script src ="{{ "/js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
101100< script src ="{{ "/js/pageContent.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
Original file line number Diff line number Diff line change 3232//////////////////////////back to top////////////////////////////
3333( function ( ) {
3434 var backToTop = document . querySelector ( '.back-to-top' )
35- console . log ( backToTop ) ;
36- window . onscroll = function ( ) {
35+ var backToTopA = document . querySelector ( '.back-to-top a' )
36+ // console.log(backToTop);
37+ window . addEventListener ( 'scroll' , function ( ) {
38+
3739
3840 // 页面顶部滚进去的距离
3941 var scrollTop = Math . max ( document . documentElement . scrollTop , document . body . scrollTop )
4042
41- if ( scrollTop > 200 ) {
43+ if ( scrollTop > 200 ) {
4244 backToTop . classList . add ( 'back-to-top-show' )
43- } else {
45+ } else {
4446 backToTop . classList . remove ( 'back-to-top-show' )
4547 }
46- }
48+ } )
49+
50+ // backToTopA.addEventListener('click',function (e) {
51+ // e.preventDefault()
52+ // window.scrollTo(0,0)
53+ // })
4754} ( ) ) ;
Original file line number Diff line number Diff line change @@ -65,5 +65,4 @@ <h2 id="y{{ post.date | date: '%Y' }}">{{ post.date | date: '%Y' }}</h2>
6565 </ div >
6666 </ div >
6767</ div >
68- < script src ="{{ "/js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
6968< script src ="{{ "/js/pageContent.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
Original file line number Diff line number Diff line change @@ -55,5 +55,4 @@ <h2 id="{{category | first}}">{{category | first}}</h2>
5555 </ div >
5656 </ div >
5757</ div >
58- < script src ="{{ "/js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
5958< script src ="{{ "/js/pageContent.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
Original file line number Diff line number Diff line change @@ -59,5 +59,4 @@ <h2 id="{{ tag }}">{{ tag }}</h2>
5959 </ div >
6060 </ div >
6161</ div >
62- < script src ="{{ "/js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
6362< script src ="{{ "/js/pageContent.js " | prepend: site.baseurl }}" charset="utf-8"> </ script >
You can’t perform that action at this time.
0 commit comments