A
A
Anatoly Filippov2016-05-25 12:03:53
JavaScript
Anatoly Filippov, 2016-05-25 12:03:53

Why is horizontal scrolling jerky on OSX in Safari?

Good afternoon! Faced such an interesting bug - horizontal scrolling twitches in safari. Here is the site where I need to do it: zaozyorina.ru
I did it through a script

<script type="text/javascript">
    var wDelta = 100;
    function scrollDoc(e) {
        if (!e) e = event;
        if (e.preventDefault) { e.preventDefault(); } else { e.returnValue = false; }
        var __delta = e.wheelDelta || -e.detail;
        __delta /= Math.abs(__delta);
        document.documentElement.scrollLeft -= __delta * wDelta; // FF, Opera, IE
        if (this.attachEvent) return false;
        document.body.scrollLeft -= __delta * wDelta; // Chrome
    }
    window.onload = function() {
        var html = document.documentElement;
        if (html.attachEvent) {
            html.attachEvent("onmousewheel", scrollDoc); // IE and Opera
        } else {
            html.addEventListener("DOMMouseScroll", scrollDoc, false); // FF
            html.addEventListener("mousewheel", scrollDoc, false); // Chrome
        }
    }
</script>

Then I think let me do it on jquery, I found one demo https://www.designedbyaturtle.co.uk/demos/horizont... I
open it in safari - it also twitches. Now the question is how to win?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question