Skip to content

Commit 06dd8ed

Browse files
committed
instantsearch.js: Hide stats on empty search string
1 parent 232be46 commit 06dd8ed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/js/instantsearch.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
version = 'master';
1010
}
1111
const hitsContainer = '#hits';
12+
const statsContainer = '#stats';
1213
const paginationContainer = '#pagination';
1314
const search = instantsearch({
1415
indexName: 'ezplatform',
@@ -23,9 +24,11 @@
2324
searchFunction(helper) {
2425
if (helper.state.query) {
2526
helper.search();
27+
$(statsContainer).css('visibility', 'visible');
2628
$(paginationContainer).show();
2729
} else {
2830
$(hitsContainer).empty();
31+
$(statsContainer).css('visibility', 'hidden');
2932
$(paginationContainer).hide();
3033
}
3134
},
@@ -76,7 +79,7 @@
7679
hitsPerPage: 10,
7780
}),
7881
instantsearch.widgets.stats({
79-
container: '#stats',
82+
container: statsContainer,
8083
templates: {
8184
text: `<h1>
8285
Search results ({{#helpers.formatNumber}}{{nbHits}}{{/helpers.formatNumber}})

0 commit comments

Comments
 (0)