fix: consistent location of search result

* fix 1098

* Update component.js

* Update component.js
This commit is contained in:
沈唁
2020-05-22 15:25:40 +05:30
committed by GitHub
parent c0d32805c9
commit e9dd2de384
+11 -2
View File
@@ -171,11 +171,20 @@ function bindEvents() {
const $inputWrap = Docsify.dom.find($search, '.input-wrap');
let timeId;
// Prevent to Fold sidebar
/**
Prevent to Fold sidebar.
When searching on the mobile end,
the sidebar is collapsed when you click the INPUT box,
making it impossible to search.
*/
Docsify.dom.on(
$search,
'click',
e => e.target.tagName !== 'A' && e.stopPropagation()
e =>
['A', 'H2', 'P', 'EM'].indexOf(e.target.tagName) === -1 &&
e.stopPropagation()
);
Docsify.dom.on($input, 'input', e => {
clearTimeout(timeId);