Algolia instantsearch.js callback function

只愿长相守 提交于 2019-12-09 17:00:44

问题


I am using Algolia instantsearch.js as my site search.

The setup process was rather easy and straightforward, including .js and .css files, creating templates and then create one more .js file with app() function for setting up my app (appId, apiKey, indexName) and widgets.

What I need is a function that will execute each time a search function ran, preferably right after the hits are shown.

Maybe there is a widget for that?

Thanks!


回答1:


You can listen the render event like described here, it's an event triggered once all widgets have been rendered:

var search = instantsearch({...});
search.on('render', function() {
   // FIXME
});

You could also create a custom widget and do a specific action in the render method.



来源:https://stackoverflow.com/questions/36640641/algolia-instantsearch-js-callback-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!