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

Multiple ion-slides broken in same page on PC view #12008

Closed
pikotea opened this issue Jun 11, 2017 · 8 comments
Closed

Multiple ion-slides broken in same page on PC view #12008

pikotea opened this issue Jun 11, 2017 · 8 comments

Comments

@pikotea
Copy link
Contributor

pikotea commented Jun 11, 2017

Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[x] 3.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
There are ion-slides A and ion-slides B in same page on PC View(ex: Desktop Chrome).
Dragging A will also cause B to move.

Steps to reproduce:

<ion-slides [ngStyle]="{height: '100px'}">
  <ion-slide>A1</ion-slide>
  <ion-slide>A2</ion-slide>
  <ion-slide>A3</ion-slide>
</ion-slides>

<ion-slides [ngStyle]="{height: '100px'}">
  <ion-slide>B1</ion-slide>
  <ion-slide>B2</ion-slide>
  <ion-slide>B3</ion-slide>
</ion-slides>

Related code:

Probably, this is the cause.
https://github.com/ionic-team/ionic/blob/master/src/components/slides/swiper/swiper-events.ts#L76

@jgw96
Copy link
Contributor

jgw96 commented Jun 12, 2017

Thanks for using Ionic! We will look into this.

@jgw96 jgw96 added the v2 label Jun 12, 2017
@Ocelyn
Copy link

Ocelyn commented Jun 29, 2017

There is someone who as a temporary fix for that? I was hoping this bug to be fixed on the next update of Ionic but it was not the case, and my project is using some slides component on PC and I have to deliver it soon. thank you so much for your help

@jrmlt
Copy link

jrmlt commented Jun 30, 2017

Probably same issue but my ion-slides are on different tabs.
Modifying the listener target by touchEventsTarget for the following lines fixed the issue for me:
https://github.com/ionic-team/ionic/blob/master/src/components/slides/swiper/swiper-events.ts#L76
https://github.com/ionic-team/ionic/blob/master/src/components/slides/swiper/swiper-events.ts#L81

if ((s.simulateTouch && !plt.is('ios') && !plt.is('android')) || (s.simulateTouch && !s._supportTouch && plt.is('ios')) || plt.getQueryParam('ionicPlatform')) {
  // mousedown
  plt.registerListener(touchEventsTarget, 'mousedown', function (ev) {
    onTouchStart(s, plt, ev);
  }, { zone: false }, unregs);
  // mousemove
  plt.registerListener(touchEventsTarget, 'mousemove', function (ev) {
    onTouchMove(s, plt, ev);
  }, { zone: false }, unregs);
  // mouseup
  plt.registerListener(touchEventsTarget, 'mouseup', function (ev) {
    onTouchEnd(s, plt, ev);
  }, { zone: false }, unregs);
 }

Don't know if this is a copy/paste typo or if there was some meaning to bind the document instead of the slides div.

@ivanmayes
Copy link

ivanmayes commented Aug 23, 2017

Also having this issue. Confirmed that @jrmlt's fix works for sliders on the same page on desktop. @jgw96 Is this fix an appropriate change to be merged in? Happy to submit a PR if that's the issue keeping this from going in. Thanks!

@kensodemann
Copy link
Member

Please try the following nightly build and let me know if it addresses your issue:

npm i [email protected] --save --save-exact

@ivanmayes
Copy link

@kensodemann Looks right to me!

@BehrouzSohrabi
Copy link

BehrouzSohrabi commented Jan 5, 2018

I had the same problem. It was an overflow issue. Sliders container overflow must be set to hidden.

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants