diff --git a/js/main.js b/js/main.js index ae5f154..290ed65 100644 --- a/js/main.js +++ b/js/main.js @@ -204,16 +204,16 @@ $(document).ready(function () { history.replaceState(null, path, '#' + path); if (path) { + var zeroMdElement = document.querySelector("zero-md"); + if (zeroMdElement) { + document.querySelector("body > div.container").removeChild(zeroMdElement); + } + var readmePath = getREADMEmdFile(filesData, path); if (readmePath) { - var zeroMdElement = document.createElement("zero-md"); + zeroMdElement = document.createElement("zero-md"); zeroMdElement.setAttribute("src", filesBaseUrl + readmePath); document.querySelector("body > div.container").appendChild(zeroMdElement); - } else { - var zeroMdElement = document.querySelector("zero-md"); - if (zeroMdElement) { - document.querySelector("body > div.container").removeChild(zeroMdElement); - } } }