mount-swiper.js 853 B

123456789101112131415161718192021222324252627282930313233
  1. import { needsNavigation, needsPagination, needsScrollbar } from './utils.js';
  2. function mountSwiper(_ref, swiperParams) {
  3. let {
  4. el,
  5. nextEl,
  6. prevEl,
  7. paginationEl,
  8. scrollbarEl,
  9. swiper
  10. } = _ref;
  11. if (needsNavigation(swiperParams) && nextEl && prevEl) {
  12. swiper.params.navigation.nextEl = nextEl;
  13. swiper.originalParams.navigation.nextEl = nextEl;
  14. swiper.params.navigation.prevEl = prevEl;
  15. swiper.originalParams.navigation.prevEl = prevEl;
  16. }
  17. if (needsPagination(swiperParams) && paginationEl) {
  18. swiper.params.pagination.el = paginationEl;
  19. swiper.originalParams.pagination.el = paginationEl;
  20. }
  21. if (needsScrollbar(swiperParams) && scrollbarEl) {
  22. swiper.params.scrollbar.el = scrollbarEl;
  23. swiper.originalParams.scrollbar.el = scrollbarEl;
  24. }
  25. swiper.init(el);
  26. }
  27. export { mountSwiper };