x
1
<!--
2
We provide a globally available openKbSearch function
3
that you can call it in your custom header code when
4
you want to open the mobile search.
5
-->
6
7
8
<!-- usage example: -->
9
<button class="custom-search-trigger" onclick="openKbSearch()">
10
<img src="https://stonly.com/resources/icons/search.svg" />
11
</button>
12
<script>
13
const customTriggerElement = document.querySelector('.custom-search-trigger');
14
customTriggerElement.addEventListener('click', window.openKbSearch);
15
</script>
16
17
18
<!-- or like this: -->
19
<button type="button" onclick="openKbSearch()">Open search</button>
const customTriggerElement = document.querySelector('.custom-search-trigger');
How to do it
When you set up a custom header in your Knowledge Base you will lose Stonly's default mobile header, which contains the "Search" icon.
You can regain that functionality by creating a search trigger in your own mobile header version and calling a globally available dedicated function which will open the search.