run js after sort/filter on collection page

run js after sort/filter on collection page

milpool
Visitor
2 0 0

i am using js to alter each item's info after the page loads.  however, when a collection is sorted and the items are reloaded the effect is removed.  the sort function is not included in the API and mutation observer isn't working.  how can i detect when the sort/filter function is complete and the items are done reloading?  thanks!

Replies 3 (3)

Liam
Shopify Staff
2945 316 829

Hi Milpool,

 

The sort / filter events may work differently depending on which theme you're using, which theme are you testing this on?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

milpool
Visitor
2 0 0
oh! i didn't realize that! we are using Stiletto version 3.2.1

thank you!
Liam
Shopify Staff
2945 316 829

I'd recommend reaching out to their support team at: https://fluorescent.co/contact

 

And explain what you're trying to achieve - I believe what you will need from them is info on the JavaScript events for sorting and item reloading, so that you know what event to listen for, which will then allow you to add your own custom JS to apply afterwards. 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog