SHARE
TWEET

Sites

a guest Oct 17th, 2019 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function () {
  2.         var mobileSwiper;
  3.         var desktopSwiper;
  4.         var options = {
  5.             direction: 'vertical',
  6.             slidesPerView: 'auto',
  7.             freeMode: true,
  8.             scrollbar: {
  9.                 el: '.swiper-scrollbar',
  10.             },
  11.             mousewheel: true,
  12.         };
  13.  
  14.         $('.js-desktop-slider img').on('load', function () {
  15.             desktopSwiper = new Swiper('.js-desktop-slider', options);
  16.  
  17.             desktopSwiper.on('scroll', function () {
  18.                 var translateValue = this.getTranslate();
  19.                 var heightDesktopSlider = $('.js-desktop-slider .b-screens__img').outerHeight(true),
  20.                     heightMobileSlider = $('.js-mobile-slider .b-screens__img').outerHeight(true);
  21.                 var calculateTranslateValue = heightMobileSlider / heightDesktopSlider * translateValue;
  22.                 mobileSwiper.setTranslate(calculateTranslateValue);
  23.             });
  24.         });
  25.  
  26.         $('.js-mobile-slider img').on('load', function () {
  27.             mobileSwiper = new Swiper('.js-mobile-slider', options);
  28.  
  29.             mobileSwiper.on('scroll', function () {
  30.                 var translateValue = this.getTranslate();
  31.                 var heightDesktopSlider = $('.js-desktop-slider .b-screens__img').outerHeight(true),
  32.                     heightMobileSlider = $('.js-mobile-slider .b-screens__img').outerHeight(true);
  33.                 var calculateTranslateValue = heightDesktopSlider / heightMobileSlider * translateValue;
  34.                 desktopSwiper.setTranslate(calculateTranslateValue);
  35.             });
  36.         });
  37.     });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top