I hope components will work as intended very very soon with Collection items. The issue I have seems to be a single bug and I tried to look for a hack around it. Is there a way to hook a custom function to remove the empty images first before initiating the Slider function?
I tried your code and I had a similar script before I posted here. The issue with the script is that the jQuery library and Webflow library (with the slider component) loads before the custom script before the closing-body tag. Meaning, the slider will have been rendered before the .remove() script, with the slides’ positions already set and still showing an empty slide.
With that in mind. I had to find a way to refresh the sliders after the empty images are removed.
I was able to fix the empty last slides with the functions below.
First I remove the empty slides and images after all the images have loaded:
Then, the next function will have to be inside my “expand accordion” script. When the accordion is expanded, this function will re-render the slider inside it.