mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-02 02:42:41 +02:00
fix: h3 topics with Markdown formatting causes a glitch on mobile (#1467)
* fixed h3 topics with Markdown formatting causes a glitch on mobile * replaced currenttarget to headings for if check * use var instead of es6
This commit is contained in:
parent
79b5ffd700
commit
084a49819f
1 changed files with 9 additions and 3 deletions
|
@ -187,10 +187,16 @@ class SideNav extends React.Component {
|
|||
createToggler('#navToggler', '#docsNav', 'docsSliderActive');
|
||||
createToggler('#tocToggler', 'body', 'tocActive');
|
||||
|
||||
const headings = document.querySelector('.toc-headings');
|
||||
var headings = document.querySelector('.toc-headings');
|
||||
headings && headings.addEventListener('click', function(event) {
|
||||
if (event.target.tagName === 'A') {
|
||||
document.body.classList.remove('tocActive');
|
||||
var el = event.target;
|
||||
while(el !== headings){
|
||||
if (el.tagName === 'A') {
|
||||
document.body.classList.remove('tocActive');
|
||||
break;
|
||||
} else{
|
||||
el = el.parentNode;
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue