Hide external controls when not required #4397
-
Hello, first of all thank you for this wonderful slider. I'm using Swiper React, and I'm very satisfied with it. Because of the layout of my page, I have implemented the control buttons outside of the slider, so I can control the slider using a ref:
The controls are two simple divs:
Everything is working fine. However, I need to hide the slider-controls div if the number of slides is insufficient. I think I have to check a double condition like:
but I dont know how to implement it in a React way. So the question is: is there any elegant or hacky way as well to hide the external control buttons if the number of slides is insufficient? Any help will be really appreciated! Thank you in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can listen for Swiper's |
Beta Was this translation helpful? Give feedback.
You can listen for Swiper's
progress
(add viaonProgress
prop) event, this is place where isBeginning and isEnd set. In this event handler you can update the state (to show/hide nav buttons).