在使用iscroll插件做滚动后,发现此区域无法拉动页面,尝试了很多方法  最终解决方法如下

	//横向滚动列表
      $('#hot,#hot1').each(function () {
        var self = $(this),
          length = self.find('li').length,
          w = length * 2.45;     //手机版一个li的宽度,我这里用的是rem
        self.find('ul').width(w+"rem");
      });

      $('#hot,#hot1').each(function () {
        var timeId;
         new iScroll(this, {
          hScroll: true,
            onBeforeScrollStart: function (e) {
                if ( this.absDistX > (this.absDistY + 5 ) ) {
                    // user is scrolling the x axis, so prevent the browsers' native scrolling
                    e.preventDefault();
                }
            },
            onTouchEnd: function () {
              var self = this;
              if (self.touchEndTimeId) {
                clearTimeout(self.touchEndTimeId);
              }
              self.touchEndTimeId = setTimeout(function () {
                self.absDistX = 0;
                self.absDistX = 0;  
              }, 600);
            }
        });
      })

 

相关文章:

  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-12-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2021-08-16
  • 2022-12-23
相关资源
相似解决方案