File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ $ ( document ) . ready ( function ( ) {
2+ $ ( window ) . scroll ( function ( ) {
3+ if ( $ ( this ) . scrollTop ( ) >= 100 ) {
4+ $ ( '.scrollToTop' ) . fadeIn ( ) ;
5+ } else {
6+ $ ( '.scrollToTop' ) . fadeOut ( ) ;
7+ }
8+ } ) ;
9+ $ ( '.scrollToTop' ) . click ( function ( e ) {
10+ e . preventDefault ( ) ;
11+ $ ( "html, body" ) . animate ( { scrollTop : 0 } , 500 ) ;
12+ return false ;
13+ } ) ;
14+ } ) ;
Original file line number Diff line number Diff line change @@ -100,3 +100,26 @@ footer a:visited {
100100 flex-direction : column;
101101 }
102102}
103+
104+ .scrollToTop {
105+ position : fixed;
106+ right : 10px ;
107+ bottom : 10px ;
108+ cursor : pointer;
109+ width : 50px ;
110+ height : 50px ;
111+ background-color : # 5520b6 ;
112+ border-radius : 50% ;
113+ }
114+ .scrollToTop span {
115+ position : absolute;
116+ top : 50% ;
117+ left : 50% ;
118+ margin-left : -8px ;
119+ margin-top : -12px ;
120+ border : 8px solid transparent;
121+ border-bottom-color : white;
122+ }
123+ .scrollToTop : hover {
124+ background-color : # 5836D8 ;
125+ }
Original file line number Diff line number Diff line change 77 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
88 < link rel ="stylesheet " href ="30DaysOfJavaScript/style.css " />
99 < link rel ="shortcut icon " href ="30DaysOfJavaScript/assets/favicon.png " type ="image/x-icon ">
10+
11+ < script language ="JavaScript " src ="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js "> </ script >
12+ < script src ="30DaysOfJavaScript/script.js "> </ script >
13+
1014 < title > 30 Days Of JavaScript</ title >
1115</ head >
1216
1317< body >
1418 < h1 > 30 Days Of JavaScript</ h1 >
19+ < a class ="scrollToTop "> < span > </ span > </ a >
1520 < div class ="container ">
1621 < div class ="item ">
1722 < a target ="_blank " href ="01 - Drum Kit/index.html ">
You can’t perform that action at this time.
0 commit comments