File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed
Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ <h3>{{ _('Navigation') }}</h3>
7777 < script type ="text/javascript " src ="{{ pathto('_static/copybutton.js', 1) }} "> </ script >
7878 < script type ="text/javascript " src ="{{ pathto('_static/menu.js', 1) }} "> </ script >
7979 < script type ="text/javascript " src ="{{ pathto('_static/search-focus.js', 1) }} "> </ script >
80+ < script type ="text/javascript " src ="{{ pathto('_static/smooth.js', 1) }} "> </ script >
8081 < script type ="text/javascript " src ="{{ pathto('_static/themetoggle.js', 1) }} "> </ script >
8182 {%- endif -%}
8283 {%- endif -%}
Original file line number Diff line number Diff line change 11@import url ('classic.css' );
22
3- /* Smooth scroll */
4- html {
5- scroll-behavior : auto;
6- }
7-
8- html : has (: target ) {
9- scroll-behavior : smooth;
10- }
11-
123/* Common colours */
134: root {
145 --good-color : rgb (41 100 51 );
Original file line number Diff line number Diff line change 1+ window . addEventListener ( 'load' , function ( ) {
2+ document . documentElement . style . scrollBehavior = 'auto' ;
3+
4+ const target = window . location . hash ;
5+ if ( target ) {
6+ window . scrollTo ( 0 , 0 ) ;
7+ document . querySelector ( target ) ?. scrollIntoView ( ) ;
8+ }
9+
10+ document . querySelectorAll ( 'a[href^="#"]' ) . forEach ( anchor => {
11+ anchor . addEventListener ( 'click' , function ( e ) {
12+ document . documentElement . style . scrollBehavior = 'smooth' ;
13+ } ) ;
14+ } ) ;
15+ } ) ;
You can’t perform that action at this time.
0 commit comments