plumwd

Untitled

Oct 31st, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* detect IE11 */
  2.     var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
  3.    
  4.  
  5.      $('.results-carousel-sidebar').flickity(resultsCarouselSidebar);
  6.  
  7.         // Prevent page scroll while dragging/swiping Flickity carousels
  8.         if (isIE11 == false) {
  9.  
  10.             var tapArea, startX;
  11.             tapArea = document.querySelectorAll('.reviews-carousel, .reviews-carousel-sidebar, .results-carousel, .results-carousel-sidebar');
  12.             startX = 0;
  13.             for (var item of tapArea) {
  14.                 item.ontouchstart = function(e) {
  15.                     startX = e.touches[0].clientX;
  16.                 };
  17.                 item.ontouchmove = function(e) {
  18.                     if (Math.abs(e.touches[0].clientX - startX) > 5 && e.cancelable ) {
  19.                         e.preventDefault();
  20.                     }
  21.                 };
  22.             }
  23.         } else {
  24.             console.log("it's undefined");
  25.         }
Advertisement
Add Comment
Please, Sign In to add comment