Replies: 5 comments 2 replies
-
In your case arrows should be
The reason why not just |
Beta Was this translation helpful? Give feedback.
-
@rensite There is still a valid use case to be able to react when the arrows are not needed. In my case I style the wrapper of the slider to leave enough space left and right, so the arrows can be positioned absolute and dont overlap the content. In my opinion this could be solved if the onPaginationUpdate event would fire when there is only 1 page. Currently it doesn't. With this event I could remove the spacing of the wrapper and hide the disabled arrows. Does anybody know if this can be achieved in any other way? |
Beta Was this translation helpful? Give feedback.
-
I found a workaround which is pretty solid I think (using the React version of Splide). import { Splide as SplideObj } from '@splidejs/splide'
const [showArrows, setShowArrows] = useState(false)
const handleArrowsUpdated = (
splide: SplideObj,
prev: HTMLButtonElement,
next: HTMLButtonElement,
prevIdx: number,
nextIdx: number,
) => {
setShowArrows(!(prev.disabled && next.disabled))
} <Splide onArrowsUpdated={handleArrowsUpdated} hasTrack={false}>
<div className="splide__arrows" style={{ display: showArrows ? 'initial' : 'none' }} />
<SplideTrack>
{...}
</SplideTrack>
</Splide> |
Beta Was this translation helpful? Give feedback.
-
using 1.4 I have I also tried defaulting to Any suggestions welcome or if I missed something. |
Beta Was this translation helpful? Give feedback.
-
From version 4.1.0, there is now an overflow watcher available for this type of thing. Details here Have just tried it, cut and pasted the sample code, and it worked a treat.
|
Beta Was this translation helpful? Give feedback.
-
Hello.
How can we turn off swiping/arrows/pagination when there are less items than
perPage
option?I think we need an additional option, like
watchOverflow
on Swiper.Beta Was this translation helpful? Give feedback.
All reactions