鍍金池/ 問(wèn)答/數(shù)據(jù)庫(kù)  HTML/ iscroll IOS無(wú)法滑動(dòng)

iscroll IOS無(wú)法滑動(dòng)

<div id="scroll" class="scroll">
   <div id="modal-body" class="modal-body">內(nèi)容</div>
</div>
.scroll {
      position: relative;
      line-height: 1.6;
      height: 5rem;
    }
    .modal-body {
      line-height: 1.6;
      padding: 10px 0;
      font-size: 120%;
      overflow-y: scroll;
      -webkit-overflow-scrolling: touch;
    }
$("#rule").on("click", function () {
      $(".modal").show();
      if (!haveScroll) {
        new IScroll("#scroll", {
          mouseWheel: true,
          scrollY: true,
          tap: true
        });
        haveScroll = true;
      }
    });

安卓沒(méi)問(wèn)題可以滑動(dòng),可是IOS滑不動(dòng),請(qǐng)問(wèn)是怎么回事呀,求指導(dǎo)

回答
編輯回答
吢丕

問(wèn)題已經(jīng)解決了。
為了禁止body滑動(dòng),
在安卓時(shí)添加下面代碼,IOS不添加

$(".modal").on("touchmove", function (e) {
   e.preventDefault();
});
2018年7月29日 14:37