diff --git a/lib/script.js b/lib/script.js index 7bfc553..0b42dfc 100644 --- a/lib/script.js +++ b/lib/script.js @@ -18,14 +18,14 @@ if (window.history) { el.onclick = function (e) { e.preventDefault() var parser = document.createElement('a') - parser.href = el.href - var matchedTpl = _getTemplate(el.pathname) + parser.href = e.target + var matchedTpl = _getTemplate(e.target.pathname) if (matchedTpl) { document.write(matchedTpl) document.close() - history.pushState({}, '', el.href) + history.pushState({}, '', e.target) } else { - window.location = el.href + window.location = e.target } } }