flickity icon indicating copy to clipboard operation
flickity copied to clipboard

Can't scroll past Flickity on touch device

Open flatcapco opened this issue 11 years ago • 27 comments

Flickity works fine - but I can't swipe passed it. It takes up the full viewport (which I want it to) but up and down swiping looks to be bound to the left/right slide navigating of flickity so there is no way to get to the content on the page below?

flatcapco avatar Mar 27 '15 12:03 flatcapco

I'm sorry to see you're having trouble with Flickity. Could you provide a reduced test case? See Submitting Issues in the contributing guidelines.

desandro avatar Mar 27 '15 15:03 desandro

Thanks Desandro - http://codepen.io/anon/pen/Bybzxb

So the issue is on an iPhone once you've scrolled down to where flickity sits I can navigate flickity absolutely fine - I just can't scroll past. There are no dom elements surrounding it that I can drag over.

Ideally I'm hoping for any vertical swipe allowing the user to continue down the dom (or up)

Thanks

flatcapco avatar Mar 27 '15 15:03 flatcapco

This is down to the touchVerticalScroll and will be addressed by #67 I can't wait until that is fixed as it's causing some serious issues on a current project I'm working on.

evoactivity avatar Mar 27 '15 17:03 evoactivity

Thanks Evo - what solution are you going for - a different lib?

flatcapco avatar Mar 27 '15 18:03 flatcapco

Thanks for the demo. Looks like CodePen has a bug where demo/live views cannot have their scroll set. But you can see a proper demo in the debug view. See debug CodePen http://codepen.io/desandro/debug/XJGNyr

On this demo, I'm able to scroll. On your demo, you have set touchVerticalScroll: false, which will specifically disable touch vertical scrolling.

desandro avatar Mar 27 '15 20:03 desandro

@latwelve I've seen other people mention peppermint.js http://wd.dizaina.net/en/scripts/peppermint/ I'm finding the watchCSS option incredibly useful for what i'm doing though, so right now I'm hoping the feature will be addressed before I need to push into production.

edit: so I've added a workaround into flickity for this. Did it all in the packaged version flickity.pkgd.js.

In Unidragger.prototype._dragPointerDown on line 3113 I took out

var targetNodeName = event.target.nodeName;
// HACK iOS, allow clicks on buttons, inputs, and links, or children of links
var isTouchstartNode = event.type == 'touchstart' &&
  ( allowTouchstartNodes[ targetNodeName ] || getParentLink( event.target ) );

// do not prevent default on touchstart nodes or <select>
if ( !isTouchstartNode && targetNodeName != 'SELECT' ) {
  // preventDefaultEvent( event );
}

then in Unidragger.prototype._dragPointerMove on line 3144 I replaced

if ( !this.isDragging && this.hasDragStarted( moveVector ) ) {
  this._dragStart( event, pointer );
}

with

if (Math.abs(moveVector.x) > Math.abs(moveVector.y)) {
  // start drag if pointer has moved far enough to start drag
  if ( !this.isDragging && this.hasDragStarted( moveVector ) ) {
    preventDefaultEvent( event );
    this._dragStart( event, pointer );
  }
}

so it will only prevent the default event if your are dragging horizonally, this does the job for me, for now very much a stop gap solution.

evoactivity avatar Mar 28 '15 13:03 evoactivity

Thanks for the replies guys

@desandro - that was my mistake for the demo - I removed that line and it worked fine until I then added this back into my document:

html,body { width: 100%; height: 100%; margin: 0px; padding: 0px; overflow-x: hidden; }

Which then led me to trying @evoactivity fix which works a charm - many thanks

flatcapco avatar Mar 31 '15 09:03 flatcapco

Having the same exact same issue w.vertical swipe not working -- thanks @evoactivity for the fix!

lisamayo avatar Mar 31 '15 18:03 lisamayo

Flickity also seems very laggy on my phone now on an extremely light page.. think I'll have to try another slider for my needs for now

flatcapco avatar Apr 01 '15 07:04 flatcapco

Flickity v1.0.1 has been released with fixes for touch scrolling. Try it out and holler if this problem persists.

desandro avatar Apr 27 '15 21:04 desandro

Windows Phone (8.1) on the problem still exists. :sob: (latest Flickity)

kukac7 avatar Aug 25 '15 12:08 kukac7

me too (windows phone 8.1 + latest flickity) can't swipe verticaly

thulank avatar Dec 21 '15 07:12 thulank

For me this only seems to occur if you're touching the previous/next arrows while scrolling.

mstrelan avatar Jan 18 '16 10:01 mstrelan

Same issue here. Can't scroll through flickity slider

piotrkulpinski avatar Jan 26 '16 18:01 piotrkulpinski

@desandro Flickity is by far the best carousel i've used and implemented on a few sites. Really top draw stuff and please keep producing quality things like this. User experience is a dying art and I love things that work how they should! However, I do have this niggling problem that when trying to scroll vertically it seems just a bit too sensitive and if not a precise vertical scroll it begins to scroll horizontally.

I'm using the latest Flickity v1.2.1 on Chrome for Android.

Many thanks!

anthony0579 avatar Apr 11 '16 18:04 anthony0579

@anthony0579 Thanks for the kind words. I'm looking to resolve this in #343 in the next version of Flickity.

desandro avatar Apr 12 '16 13:04 desandro

@desandro This will be extremely welcomed.

We are lucky enough to have a device lab in our office and can confirm that 'flicking' past a carousel is quite the challenge.

The PR in this thread is perfect, setting the dragThreshold to just 10 proved enough for us 👍

shakyShane avatar Jun 21 '16 11:06 shakyShane

touchVerticalScroll:false still not preventing scrolling on android 5.1 chrome latest, firefox version 2.0.5

sashabeep avatar Oct 19 '16 08:10 sashabeep

Got a bug here where it is impossible to scroll past the first image in a slider. dragThreshold seems to work from all the others.

xpd avatar Nov 07 '16 06:11 xpd

Hi, I had a problem with Flickity on Windows Phone device. When you have full page height carousel, it's imposible to scroll down the page.

Fixed it via CSS:

.flickity-enabled.is-draggable .flickity-viewport{
    touch-action: pan-y !important;
}

This hack is for rewrite inline rule style="touch-action: none;" on this block.

Works for me. May be there is a better solution?

va-loo avatar May 18 '17 12:05 va-loo