Skip to content

Commit e79354a

Browse files
authored
resolves #40 reset search result scroll when query is changed (PR #41)
1 parent aa2397e commit e79354a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/js/vendor/docsearch.bundle.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
1616
algoliaOptions: { hitsPerPage: parseInt(config.maxResults) || 5 },
1717
}).autocomplete
18+
var autocomplete = search.autocomplete
19+
search.on('autocomplete:updated', function () {
20+
this.scrollTop = 0
21+
}.bind(autocomplete.getWrapper().firstChild))
1822
search.on('autocomplete:closed', function () {
19-
search.autocomplete.setVal()
20-
})
23+
this.setVal()
24+
}.bind(autocomplete))
2125
})()

0 commit comments

Comments
 (0)