Slider - the whole site. On the desktop, it works fine, with standard initialization. If I add parameters for touch devices, scrolling on the tablet works fine. And that's all, nothing else works, even on the desktop. In console

jQuery.Deferred exception: Cannot read property 'offsetHeight' of undefined TypeError: Cannot read property 'offsetHeight' of undefined 

Slider initialization code:

 var mySwiper = new Swiper ('.swiper-container', { direction: 'vertical', IOSEdgeSwipeDetection: true, onTouchStart: function() { return false; }, scrollbar: { container: '.swiper-scrollbar', hide: false, draggable: true, snapOnRelease: true } }) 

In the plugins:

 'app/libs/swiper/dist/js/swiper.min.js', 'app/libs/jquery/dist/jquery.min.js', 'app/libs/modernizr/modernizr.js', 'app/js/common.js' 

all this is minified in script.min.js. If you remove the section from initialization

 scrollbar: { container: '.swiper-scrollbar', hide: false, draggable: true, snapOnRelease: true } 

Everything starts to work, except for scrolling on touch devices.

  • one
    I would add HTML too, there are errors in it. - labris

1 answer 1

Most likely, the problem was in file minification. Transferred the swipe connection and its initialization directly to HTML - it all worked.