Skip to content

Commit 21b36be

Browse files
committed
Make crate-readme component scroll to URL fragment if specified
Fixes #1847
1 parent 12c64bc commit 21b36be

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/components/crate-readme.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@ export default Component.extend({
77
this.$('pre > code').each(function() {
88
window.Prism.highlightElement(this);
99
});
10+
this.scrollToFragment();
11+
},
12+
13+
scrollToFragment() {
14+
if (window.location.hash) {
15+
window.location.href = window.location.href; // eslint-disable-line no-self-assign
16+
}
1017
},
1118
});

0 commit comments

Comments
 (0)