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>
77
77
< script type ="text/javascript " src ="{{ pathto('_static/copybutton.js', 1) }} "> </ script >
78
78
< script type ="text/javascript " src ="{{ pathto('_static/menu.js', 1) }} "> </ script >
79
79
< script type ="text/javascript " src ="{{ pathto('_static/search-focus.js', 1) }} "> </ script >
80
+ < script type ="text/javascript " src ="{{ pathto('_static/smooth.js', 1) }} "> </ script >
80
81
< script type ="text/javascript " src ="{{ pathto('_static/themetoggle.js', 1) }} "> </ script >
81
82
{%- endif -%}
82
83
{%- endif -%}
Original file line number Diff line number Diff line change 1
1
@import url ('classic.css' );
2
2
3
- /* Smooth scroll */
4
- html {
5
- scroll-behavior : auto;
6
- }
7
-
8
- html : has (: target ) {
9
- scroll-behavior : smooth;
10
- }
11
-
12
3
/* Common colours */
13
4
: root {
14
5
--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