Horizontal iScroll issues on desktop browsers

前提是你 提交于 2019-12-12 15:38:22

问题


I'm trying to implement horizontal scrolling for a desktop website using iScroll.js. Dragging is working fine, and styling is applied ok, but I'm finding issues with scrolling.

Initially I used iScroll 4.1.7 Mousewheel not working as it should on PC's On Macs Chrome and Safari have issues with preventing native scrolling, specifically, if you the user has activated the trackpad preference: Swipe between pages, if you scroll to the left (back), it opens previous page. Firefox is scrolling OK Dragging is working fine.

Subsequently tried v4.2.5: https://github.com/cubiq/iscroll This doesn't seem to scroll or mousewheel at all on desktop browsers. Dragging works fine.

This is how I'm trying to initialize iScroll: (as defined in the documentation here: http://cubiq.org/iscroll-4 )

<script type="application/javascript" src="iscroll.js"></script>
<script type="text/javascript">
var myScroll;
function loaded() {
myScroll = new iScroll('wrapper');
}
document.addEventListener('DOMContentLoaded', loaded, false);
</script>`

Below is a demo of:

iScroll 4.1.7 http://anything.is/iscroll4-1-7

iScroll 4.2.5 http://anything.is/iscroll4-2-5

Any ideas if I am doing something wrong, or if these are real issues?


回答1:


I don't really know if the mousewheel option is supposed to be set by default, but you could try and add it like this:

function loaded() {
    myScroll = new iScroll('wrapper', {
        wheelHorizontal: true
    });
}

This is tested with iscroll 4.2.2 on Chrome, meaning it might not be the perfect solution but sure looks like a quick fix. 4.2.5 should do it!

Found the answer here: iScroll 4 horizontal mousewheel scroll There's a jsFiddle in the page you can check it out! Hope this helped.



来源:https://stackoverflow.com/questions/15352639/horizontal-iscroll-issues-on-desktop-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!