@@ -17,7 +17,7 @@ <h1 class="wc-Hero-title wc-Title--xl">Welcome aboard!<br/>Get started below...<
17
17
< div class ="contributors__item ">
18
18
< div class ="contributors__item__header ">
19
19
< div class ="wc-content contributors__item__title ">
20
- < h2 >
20
+ < h2 id =" reproduce " >
21
21
< button class ="contributors__item__btn is-active " type ="button ">
22
22
How to Reproduce a Bug
23
23
< span class ="wc-Icon wc-Icon--contributors wc-Icon--contributors--disabled wc-Icon--minus " aria-hidden ="true "> </ span >
31
31
< div class ="contributors__item ">
32
32
< div class ="contributors__item__header ">
33
33
< div class ="wc-content contributors__item__title ">
34
- < h2 >
34
+ < h2 id =" diagnose " >
35
35
< button class ="contributors__item__btn " type ="button ">
36
36
How to Diagnose a Bug
37
37
< span class ="wc-Icon wc-Icon--contributors wc-Icon--contributors--disabled wc-Icon--minus " aria-hidden ="true "> </ span >
45
45
< div class ="contributors__item ">
46
46
< div class ="contributors__item__header ">
47
47
< div class ="wc-content contributors__item__title ">
48
- < h2 >
48
+ < h2 id =" outreach " >
49
49
< button class ="contributors__item__btn " type ="button ">
50
50
How to Do Site Outreach
51
51
< span class ="wc-Icon wc-Icon--contributors wc-Icon--contributors--disabled wc-Icon--minus " aria-hidden ="true "> </ span >
59
59
< div class ="contributors__item ">
60
60
< div class ="contributors__item__header ">
61
61
< div class ="wc-content contributors__item__title ">
62
- < h2 >
62
+ < h2 id =" contribute " >
63
63
< button class ="contributors__item__btn " type ="button ">
64
64
Contribute to this site
65
65
< span class ="wc-Icon wc-Icon--contributors wc-Icon--contributors--disabled wc-Icon--minus " aria-hidden ="true "> </ span >
77
77
{%- block extrascripts -%}
78
78
< script >
79
79
$ ( function ( ) {
80
- var lightElm = $ ( '.wc-Hero-img' ) ;
81
- var sections = $ ( '.contributors__item__content' ) ;
80
+ var lightElm = $ ( '.wc-Hero-img' ) ;
81
+ var sections = $ ( '.contributors__item__content' ) ;
82
82
var ACTIVE_CLASS = 'is-active' ;
83
- var OPEN_CLASS = 'is-open' ;
83
+ var OPEN_CLASS = 'is-open' ;
84
84
$ ( '.contributors__item__title' ) . click ( function ( ) {
85
85
$ ( this ) . find ( '.contributors__item__btn' ) . toggleClass ( ACTIVE_CLASS )
86
86
. closest ( '.contributors__item' ) . find ( '.contributors__item__content' )
87
87
. toggleClass ( OPEN_CLASS )
88
88
lightElm . toggleClass ( ACTIVE_CLASS , sections . hasClass ( 'is-open' ) ) ;
89
89
} ) ;
90
+
91
+ // if the page was loaded with a hash, it's probably an id for linking so let's
92
+ // try to open the right section and scroll there.
93
+ var id ;
94
+ if ( id = location . hash ) {
95
+ if ( ! $ ( id ) . find ( '.contributors__item__btn' ) . hasClass ( ACTIVE_CLASS ) ) {
96
+ $ ( id ) . parent ( ) . trigger ( 'click' ) ;
97
+ }
98
+ window . scrollTo ( 0 , $ ( id ) . offset ( ) . top ) ;
99
+ }
90
100
} ) ;
91
101
</ script >
92
102
{%- endblock %}
0 commit comments