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:
Sakti Kr Chourasia 2019-05-18 11:27:57 +05:30 committed by Endi
parent 79b5ffd700
commit 084a49819f

View file

@ -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);