Giter Club home page Giter Club logo

Comments (7)

nosTa1337 avatar nosTa1337 commented on July 28, 2024 1

I think he has the same issue as I do. You have a list with clickable items. On the list is a longpress event. Now pressing on any item on the list will trigger not only the long press event, it will also trigger the click event on the item. Something like $event.preventDefault().

from ngx-long-press2.

gabriel-gn avatar gabriel-gn commented on July 28, 2024 1

I understand

You want to execute the click function after pressing a long click right?

Sorry, maybe I didn't explain properly.
On a div with (onLongPress) and (click) outputs, whenever I trigger "onLongPress", "click" is still being executed after "onLongPress".
I wanted "click" to have behavior A, and "onLongPress" behavior B, but when I trigger "onLongPress" B is executed and A after that.

from ngx-long-press2.

NusryNizam avatar NusryNizam commented on July 28, 2024 1

I face the same issue. When there is a (click) event and (onLongPress) event on the same element, click event fires after the onLongPress event. Is there any way to prevent this?

from ngx-long-press2.

AnthonyNahas avatar AnthonyNahas commented on July 28, 2024

I understand

You want to execute the click function after pressing a long click right?

from ngx-long-press2.

logan-jobzmall avatar logan-jobzmall commented on July 28, 2024

What I did to fix this issue

(mouseup)="$event.stopPropagation()" (touchend)="$event.stopPropagation()" (click)="$event.stopPropagation(); $event.preventDefault();"

from ngx-long-press2.

NusryNizam avatar NusryNizam commented on July 28, 2024

@logan-jobzmall Thanks.

PS: I came across the (contextmenu) event which can be used for long-press on mobile and right-click on desktops.

from ngx-long-press2.

AnthonyNahas avatar AnthonyNahas commented on July 28, 2024

any PR for this ticket or should I close it for the moment?

from ngx-long-press2.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.