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

Unable to swipe once tap is added to the element inside slide. #2

Closed
irman opened this issue Dec 28, 2016 · 4 comments
Closed

Unable to swipe once tap is added to the element inside slide. #2

irman opened this issue Dec 28, 2016 · 4 comments

Comments

@irman
Copy link
Contributor

irman commented Dec 28, 2016

Hi,

Nice plugin btw. I'm just having a problem assigning tap event on the slider.

Here's the code:

<slides #slides>
    <slide class="slide-1">
        <Image src="Cat-hd-wallpapers.jpg" (tap)="getData()"></Image>
    </slide>
    <slide class="slide-2">
        <Image src="20130604-600.jpg"></Image>
    </slide>
</slides>

As you can see, there's (tap)="getData()" on the Image inside the slide. This will break the slider swipe. How can I prevent this? I've tried moving the (tap) attribute to the slide element but that won't trigger any tap event. Any input is appreciated. Thanks!

Tested on an Android emulator.

@ChristelleThiry
Copy link

Hello,

I have the same issue, did you find the solution ?

Thanks !

@irman
Copy link
Contributor Author

irman commented Jan 9, 2017

@ChristelleThiry Not yet, I just disabled the swiping as the tap action is the priority. I've added some timeout that just auto rotates the banner.

@heese
Copy link

heese commented Jan 18, 2017

@irman, @ChristelleThiry, @TheOriginalJosh

I don't have time to make the changes to the library -- I hope someone else has :-)

I change the file SlidesComponent as follows:

  1. Under the last line starting with @Input ... add the following line:
    @Output('tap') tap = new EventEmitter<gestures.GestureEventData>();
  2. In the method applySwipe add before this.currentSlide.slide.layout.on('pan', ... add the line:
    this.currentSlide.slide.layout.on('tap', (args: gestures.GestureEventData): void => { this.tap.next(args); });
  3. In the html file of the app add an event handler for tap:
    <slides #slideShow [loop]="true" (tap)="navigateToDetails()">
  4. Implement the method navigateToDetails in the corresponding component.

You might want to extend the implementation to include the slide ID or something similar.

@JoshDSommer
Copy link
Owner

Sorry, guy's I've been swamped with some other things. If someone else could Add this I would gladly accept a PR. if not I'll try to add it sometime this week.

Thanks.

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

No branches or pull requests

4 participants