Advertisement
Udoro

Thumbnail slider sync code

Sep 25th, 2022
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <script>
  2.  
  3. function initSync() {
  4. initTimeout = setTimeout(syncSliders, 50);
  5. }
  6.  
  7. function syncOnResize() {
  8. resizeTimeout = setTimeout(syncSliders, 260);
  9.  
  10. }
  11.  
  12. function syncSliders() {
  13. const main = bricksData.splideInstances['dqnrgd'],
  14. thumbnail = bricksData.splideInstances['cwjtxi']
  15.  
  16. if( main && thumbnail) {
  17. main.sync(thumbnail)
  18.  
  19. }
  20.  
  21. clearTimeout(initTimeout);
  22.  
  23. }
  24.  
  25.  
  26.  
  27. document.addEventListener( 'DOMContentLoaded', initSync)
  28. window.addEventListener("resize", syncOnResize)
  29.  
  30.  
  31. </script>
  32.  
  33.  
  34. <style>
  35.  
  36. #thumbnail .splide__pagination__page{
  37. transition: width 0.4s, color 0.4s;
  38. }
  39.  
  40. #thumbnail-slider .splide__slide.is-active {
  41. border: 3px solid transparent !important;
  42. transform: scale(1.2);
  43. }
  44.  
  45.  
  46.  
  47. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement