Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock vertical touch #78

Open
srjsrj opened this issue Jan 29, 2013 · 10 comments
Open

Lock vertical touch #78

srjsrj opened this issue Jan 29, 2013 · 10 comments

Comments

@srjsrj
Copy link

srjsrj commented Jan 29, 2013

Hello.
Is it possible not to lock vertical touch on touch-devices? Its impossible to scroll page.
It happens when I trying to scroll up(start dragging from smoothdivscroll)

Thanks.

@tkahn
Copy link
Owner

tkahn commented Feb 14, 2013

Yes, there is a possibility that you could fix that. I use jQuery Kinetic for handing touch scrolling. Check out that page. Here's the part in Smooth Div Scroll where I set up the events for touch scrolling. You might want to change some stuff there as well.

/*****************************************
SET UP EVENTS FOR TOUCH SCROLLING
*****************************************/
if (o.touchScrolling && el.data("enabled")) {
    // Use jquery.kinetic.js for touch scrolling
    // Vertical scrolling disabled
    el.data("scrollWrapper").kinetic({
        y: false,
        moved: function (settings) {
            if (o.manualContinuousScrolling) {
                if (el.data("scrollWrapper").scrollLeft() <= 0) {
                    self._checkContinuousSwapLeft();
                } else {
                    self._checkContinuousSwapRight();
                }
            }
        },
        stopped: function (settings) {
            // Stop any ongoing animations
            el.data("scrollWrapper").stop(true, false);

            // Stop any ongoing auto scrolling
            self.stopAutoScrolling();
        }
    });
}

Let me know if you come up with something useful!!

@treckstar
Copy link

Hi guys.

Was using this plugin and ran into this same problem. It seems like vertical scrolling is being disabled by SmoothDivScroller by setting y:false.

Was curious to know if @srjsrj figured out any solution to this.

@treckstar
Copy link

In case anyone else has the same problem that I ran into with Smooth Div Scroller and the Kinetic plugin, I ended up solving this by commenting out the e.preventDefault and e.stopPropagation lines under settings.events in the Kinetic plugin.

@tkahn
Copy link
Owner

tkahn commented Jul 16, 2013

Knowing what the user means when he/she uses touch to scroll is always difficult. Sometimes it should mean "scroll the page", sometimes "scroll the scroller" and it's not always clear which it should be.

You could enable scrolling along the y axis by setting y:true in Smooth Div Scroll, but the effect would be that you can scroll the content inside Smooth Div Scroll along the y axis (given that there's hidden content inside the scroller to scroll). But if I understand you correctly the problem is about scrolling the page using touch and then I think the Kinetic plugin is the place to look, just like you suggest.

I'm not closing this issue but I haven't decided yet how to solve it. If you take a look at other stuff where hidden content is scrolled, like a Google Map, you see that all touch scrolling done inside the map scrolls the map and not the page and this is the type of behavior that you want. On the other hand Smooth Div Scroll is not about scrolling along the y axis so a possible solution would be to try to separate y axis gestures from x axis gestures and make them work on different levels.

@hype1
Copy link

hype1 commented Feb 12, 2014

Has anyone found a fix for this yet? I would suggest a forceVerticalPageScroll (or disableVerticalDivScroll) boolean so a user can choose to use this touch movement for the page scrolling but I can't figure out how to get there. I have several Smooth-Div-Scrollers on a webpage and they have a width of 100% of the page with some horizontal space in between them. On the iPhone the user is now unable to scroll the page up and down when I activate touchScrolling, except when she/he magically finds a small spot in between the scrollers. I am aware this is a complicated issue, due to many counteractive touch interactions and corresponding events.

@renatocarvalho
Copy link

+1 to allow an option to configure this. I ran the same issue and it's not natural lock vertical scroll on touch devices.

@jordanoverbye
Copy link

Has anyone found a fix for this yet?

@crmb
Copy link

crmb commented Oct 6, 2015

thanks @treckstar for the tips !
An option should be added.

@nicmare
Copy link

nicmare commented Jan 3, 2016

+1

@vanshajr-cuelogic
Copy link

Hi, I have tried both the code which is suggested by @tkahn and @treckstar but still facing the same issue, while changing y:true, it only scroll the particular section of scrollwrapper not the container where i have appended the kinetic, kindly let me know if any one facing the same issue and got some solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants