Advertisement
oscarviedma

Scripts jQuery para sincronizar e inicializar swiper.js en divi

Apr 2nd, 2021
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
  2. <script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
  3.  
  4. <script>
  5. jQuery(function($){
  6. // Agregar clase "swiper-wrapper" despues de "ov-coverflow-blog"
  7. $(".ov-coverflow-blog .et_pb_ajax_pagination_container").addClass("swiper-wrapper");
  8.  
  9. // Agregar clase "swiper-slide" a cada artículo
  10. $(".ov-coverflow-blog article").addClass("swiper-slide");
  11.  
  12. });
  13. </script>
  14.  
  15. <script>
  16. // Inicializar swiper.js
  17. jQuery(document).ready(function( $ ) {
  18. var swiper = new Swiper('.ov-coverflow-blog', {
  19. grabCursor: true,
  20. centeredSlides: true,
  21. loop: 'true',
  22. slidesPerView: 'auto',
  23. spaceBetween: 10,
  24. autoplay: true,
  25. breakpoints: {
  26. 768: {
  27. slidesPerView: 'auto',
  28. loopAdditionalSlides: 1,
  29. spaceBetween: 20,
  30. },
  31. 980: {
  32. spaceBetween: 40,
  33. },
  34. }
  35. })
  36. });
  37. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement