mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-14 04:15:40 +00:00
fix(search): after dialog closes, results reappear on refresh (#1161)
This commit is contained in:
1 parent
4cfd000001
commit
9a18bf2211
1 file changed
+8
@@ -49,6 +49,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
function removeQueryParamsFromUrl() {
|
||||
if (window.history.pushState) {
|
||||
let urlWithoutSearchParams = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.hash;
|
||||
window.history.pushState({path:urlWithoutSearchParams}, '', urlWithoutSearchParams);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for hash change event and fix responsive offset for hash links (e.g. Markdown footnotes).
|
||||
window.addEventListener("hashchange", scrollToAnchor);
|
||||
|
||||
@@ -295,6 +302,7 @@
|
||||
if ($('body').hasClass('searching')) {
|
||||
$('[id=search-query]').blur();
|
||||
$('body').removeClass('searching');
|
||||
removeQueryParamsFromUrl();
|
||||
} else {
|
||||
$('body').addClass('searching');
|
||||
$('.search-results').css({opacity: 0, visibility: 'visible'}).animate({opacity: 1}, 200);
|
||||
|
||||
Reference in new issue
Block a user