Advertisement
oscarviedma

Código para integrar Swiper.js con divi: Tutorial testimonios carrusel slider

Nov 17th, 2022
1,448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.css"/>
  2.  
  3. <script>
  4. jQuery(function($){
  5. // Insertar la paginacion swiper js
  6. $( "<div class='swiper-pagination'></div>" ).insertAfter( ".ui-swiper" );
  7.  
  8. // Insertar navegación (flechas) swiper js
  9. $( "<div class='swiper-button-next'></div><div class='swiper-button-prev'></div>" ).insertAfter( ".ui-swiper" );
  10. });
  11. </script>
  12.  
  13. <!-- Swiper JS -->
  14. <script src="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.js"></script>
  15.  
  16. <!-- Iniciar swiper -->
  17. <script>
  18. jQuery(document).ready(function( $ ) {
  19. var swiper = new Swiper('.ui-swiper', {
  20. slidesPerView: 1,
  21. spaceBetween: 30,
  22. loop: 'true',
  23. grabCursor: 'true',
  24. centeredSlides: 'true',
  25. /*speed: 500,*/
  26. navigation: {
  27. nextEl: '.swiper-button-next',
  28. prevEl: '.swiper-button-prev',
  29. },
  30. pagination: {
  31. el: '.swiper-pagination',
  32. clickable: true,
  33. },
  34. breakpoints: {
  35. 640: {
  36. slidesPerView: 2,
  37. },
  38. 768: {
  39. slidesPerView: 2,
  40. },
  41. 1024: {
  42. slidesPerView: 2,
  43. },
  44. 1200: {
  45. slidesPerView: 3,
  46. },
  47. }
  48. });
  49. });
  50. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement