woocommerce / FlexSlider

An awesome, fully responsive jQuery slider plugin
http://www.woocommerce.com/flexslider/
GNU General Public License v2.0
4.91k stars 1.69k forks source link

hiding slides with display:none to filter them... way to 'recount' the slides after doing so #1794

Closed morrow95 closed 2 months ago

morrow95 commented 3 years ago

Scenario... say I have 10 slides and 5 of those are pictures of cats while the other 5 are pictures of dogs. User clicks a button to show only dog pictures. I set the <li> of all the cat slides to display:none. Great... only the dog slides show, BUT the previous/next and 'count' of flexslider is now off.

Any way around this? Like a way to tell flexslider to 'recount' the slides (assuming the hidden ones would not be counted)? Or even just destroying the current and re-initializing the slider?

removeSlide() and addSlide() are of no use to me to solve this because I need the entire 'set' always there... I can't remove the cat sliders and then add them back later. My actual use case checks my db every 15 seconds and uses addSlide() to add newly found images in chronological order. So while I could remove the slides instead of settings them to display:none I wouldn't be able to 'get them back' later in this specific case.