检测OS x"自然滚动方向"在Chrome& FF使用javascript / jQuery

时间:2016-01-20 11:44:27

标签: javascript jquery google-chrome firefox operating-system

我正面临一个问题。我试图检测OS x用户是否具有"自然滚动方向"使用chrome或FF时启用。目前,如果用户使用以下代码在Safari上,我能够检测到它。

$("html, body").bind({'mousewheel DOMMouseScroll onmousewheel touchmove scroll': function(e, delta) {
if(Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0) {
    if(e.originalEvent.webkitDirectionInvertedFromDevice) {
        this.scrollTop += (delta);
        e.preventDefault();
    }
}}});

此stackoverflow页面仅帮助我使用上述safari解决方案。 Javascript: detect OS X "natural scroll" settings

是否有可能使用chrome& amp; FF。我需要它的原因是因为我想强制用户滚动"反向滚动方向",换句话说,当用户向下滚动时,我需要页面向下滚动。

非常感谢帮助! :)

0 个答案:

没有答案