Skip to content

How can I style the "/" between the pagination fractions? #6057

Answered by henrybabbage
henrybabbage asked this question in Q&A
Discussion options

You must be logged in to vote

I found a solution at this link https://github.com/nolimits4web/swiper/issues/3855#issuecomment-827943545

useSwiperRef.js

const useSwiperRef = () => {
	const [wrapper, setWrapper] = useState(null)
	const ref = useRef(null)

	useEffect(() => {
		setWrapper(ref.current)
	}, [])

	return [
		wrapper,
		ref
	]
}

export default useSwiperRef

const [paginationEl, paginationRef] = useSwiperRef()

And credit to @Banjer71 for their solution which I adapted too:

pagination={{
			type: 'fraction',
			el: paginationEl,
			renderFraction: (currentClass, totalClass) => {
			return '<span class="' + currentClass + '"></span>' +
							 '<span>&emsp;</span>' +
							 ' | ' +
							 '<span>&emsp;</span>…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by henrybabbage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant