Try this:
open swiper>modules>pagination>pagination.less
at the top line where the :root {...} sits, uncomment the line --swiper-pagination-bottom and --swiper-pagination-top
edit the value of those variables to the following
:root {
--swiper-pagination-bottom: auto;
--swiper-pagination-top: 8px;
}
If you use CDN to import the module,
- add the code above as option parameter as below
const params = {
injectStyles: [`
:root {
--swiper-pagination-bottom: auto;
--swiper-pagination-top: 8px;
}
...
}
- initialize the swiper - complete main javascript file code may look something like this
const swiperEl = document.querySelector('swiper-container')
const params = {
injectStyles: [`
:root {
--swiper-pagination-bottom: auto;
--swiper-pagination-top: 8px;
}
...
`],
pagination: {
clickable: true,
renderBullet: function (index, className) {
return '<span class="' + className + '">' + (index + 1) + "</span>";
},
},
}
Object.assign(swiperEl, params)
swiperEl.initialize();
....
Hope it works on your side!