• Resolved smazanti

    (@smazanti)


    Started using this plugin a couple of days ago and I like it so far. However, I can’t seem to find any events I can use.

    What I need is an event for
    – When the search is complete and suggestions are shown
    – When the suggestion box dissappears, e.g. from mouseleave event

    I tried onAjaxComplete() but it’s inaccurate, as the event is fired as soon as the AJAX search is complete – not when suggestions are shown.
    I tried using MutationObserver on the suggestions box, but it hurts performance as the element is appended through JS and therefore I would have to make a MutationObserver on the whole body element to observe when the element is appended, which hurts performance.

    I tried with document.ready, but it still doesn’t let me target the element.

    I could somewhat make it work with MutationObserver on the preloader icon – between the “x”, the search icon and the spinner, but it’s really wonky and I figured there must be a better way. I tried looking through the source code but to no avail. In the plugin documentation it doesn’t state anything about events either.

    So, are there any specific events associated with this plugin, or perhaps you could point me in the right direction of what event I could use?

    Thank you!

    • This topic was modified 1 year, 10 months ago by smazanti.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Kris

    (@c0nst)

    Hi @smazanti

    We are currently working on this functionality. It will most likely be available with v1.22.0. As soon as we finish the work, we will provide you with the development version.

    Currently, we only have this 1 event that relates to the Details Panel:
    dgwtWcasDetailsPanelLoaded

    Regards,
    Kris

    Thread Starter smazanti

    (@smazanti)

    Thank you for your answer, Kris ?? I’ll look into those events once this functionality has been implemented. Looking forward to it!

    Plugin Author Damian Góra

    (@damian-gora)

    Hi @smazanti
    We added events you can use for custom purposes. The events will be available in the next plugin release v1.22.0. There have already been implemented in the development version, so if you want, you can test them now.

    List od events:

    • fibosearch/open – After displaying the search results
    • fibosearch/close – After closing auto suggestions
    • fibosearch/show-pre-suggestions – After the search history is displayed (the search bar is on focus, but customers haven’t yet typed their query
    • fibosearch/show-suggestions – After displaying or refreshing search results
    • fibosearch/no-results – If the query gives no results
    • fibosearch/show-details-panel – After opening the Details Panel
    • fibosearch/show-mobile-overlay – After the mobile mode is opened
    • fibosearch/hide-mobile-overlay – After the mobile mode is opened

    You can listen to these events using jQuery

    jQuery( document ).on( 'fibosearch/open', () => {
      // do your stuff here
    });

    or plain JS

    document.addEventListener( 'fibosearch/close',(e) => {
      // do your stuff here
    });

    Best
    Damian

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Events for searching’ is closed to new replies.