Navigation and pagination positioning around slider (not over)
See original GitHub issueThis is a (multiple allowed):
-
bug
-
enhancement
-
feature-discussion (RFC)
-
Swiper Version: 6.0.4
-
Platform/Target and Browser Versions: Ubuntu 18 // Google Chrome 84.0.4147.105
Issue
I wish I could move arrows and pagination/scrollbar outside the slider (not over). Now it’s impossible to do it correctly and honour the vertical/horizontal direction.
swiper-container
hasoverflow:hidden
, so I can’t position arrows/pagination/scrollbar elements outside it or they get hidden. I can’t remove theoverflow:hidden
property from container or slides get visible outside the container…xxx-horizontal
andxxx-vertical
classes are added toswiper-container
, so even if I take the arrows/pagination/scrollbar outside the container, I’d be unable to know which direction is the slider configured with (yes, I could use the “all siblings css selector”~
, but I’d feel kinda dirty)
Possible solutions
- Add extra
div
around theswiper-wrapper
, something likeswiper-clip
that has theoverflow:hidden
style.
<div class="swiper-container">
<div class="swiper-clip">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
...
</div>
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<div class="swiper-scrollbar"></div>
</div>
- Search for
wrapperClass
hierarchically within the element, instead of searching only direct children. Usefind
method here (like it is used forprevEl
,nextEl
,pagination.el
, …): https://github.com/nolimits4web/swiper/blob/77d72e411ef91b7580eb8fb96f05f0e43a0a6b90/src/components/core/core-class.js#L144 This way I could create theswiper-clip
element myself
Option 1 would be my prefered, though it would not be simple, and may cause a new major version. Option 2 is very simple, just a patch.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:37
- Comments:11
Top Results From Across the Web
CSS - How to have swiper slider arrows outside of slider that ...
I am using bootstrap twitter css framework and I have tried various things but nothing worked and don't know how to achieve this?...
Read more >Swiper — Relocating Previous and Next Buttons | by Aaron K.
While creating a demo for Swiper — Uno a Cuatro Column Slider I was curious to know if previous and next buttons would...
Read more >Building modern sliders with HTML, CSS, and Swiper
Navigation, just like pagination, serves as a tool to guide through the slides with a click rather than swiping with the mouse.
Read more >Swiper custom pagination - CodePen
Slider main container -->. 2. <div class="swiper-container"> ... If we need navigation buttons -->. 14. <div class="swiper-button-prev"></div>.
Read more >Pagination - Bootstrap
In addition, as pages likely have more than one such navigation section, it's advisable to provide a descriptive aria-label for the <nav> to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I achieved navigation around with margin and position
Hi, how can I use outside navigation’s element with the React component too? At the moment I’m using CSS selector like:
but if I have more then one of the same component, the pagination click will trigger all the swipers.
I tried using
ref
but with no success because the current element is null when Swiper is initialized.