3

ナビゲーションスワイプを無効にしようとしています。ユーザーが左または右にスワイプしたときに Web ページを前後に移動させたくありません。

動作を妨げている html 要素で touch-action を none に設定できることに気付きました。ただし、オーバーフローのある子要素をスクロールすると、スクロールが「連鎖」し、戻るナビゲーションが可能になります。

そこで、html 要素に -ms-scroll-chaining: none を追加することを考えましたが、要素がスクロールする場合にのみ機能します。したがって、overflow: scroll on html を追加すると、実際にうまくいきます。しかし、今では他のブラウザにスクロールバーが表示されています。

これを行う正しい方法は何ですか?

    html {
        -ms-touch-action: none; /* Doesn't work if scrolling from child element */
        -ms-scroll-chaining: none; /* Works only with the next line */
        overflow: scroll; /* With this line all the other browsers have a scrollbar */
    }
4

2 に答える 2

4

私はこれを使用しました:

@media screen and (-ms-high-contrast: none) {
    // Windows 8+ IE only
    html {
        overflow-x: scroll;
        -ms-touch-action: none; 
        -ms-overflow-style: none;
        -ms-scroll-chaining: none; 
    }
}
于 2014-01-07T14:55:14.530 に答える
0

やってみました

body, html {
   -ms-touch-action:none;
}

スクロール可能なすべてのクラス(Y軸)に適用されます

-ms-scroll-chaining: none;

私のプロジェクトでは、快適なものをスクロールするための特別なクラスがあります。

.scroll-y {
    overflow-y: auto;
    overflow-x: hidden;
    -ms-scroll-chaining: none;
}

私のために働いた

于 2013-11-05T07:41:56.893 に答える