Skip to content

Commit a6c0427

Browse files
committed
検索UIの外側をクリックした時に検索結果を非表示にする
1 parent dbe742d commit a6c0427

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

js/crsearch/crsearch.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,12 @@ export default class CRSearch {
440440
$(e.target).blur()
441441
return this._hide_all_result()
442442
})
443+
$(document).on('pointerdown', e => {
444+
// 検索UIの外側をクリックした時、検索結果を非表示にする
445+
if (!$(e.target).closest(`.${CRSearch._KLASS}`).length) {
446+
this._hide_all_result()
447+
}
448+
})
443449

444450
const result_wrapper = $('<div />')
445451
result_wrapper.addClass(CRSearch._RESULT_WRAPPER_KLASS)

0 commit comments

Comments
 (0)