-
Notifications
You must be signed in to change notification settings - Fork 786
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
draggable blocks click #58
Comments
Here are some things you can do:
And by the way, in your demo you loop through similar elements and make them Interactable individually. You could instead pass a selector string to interact and it would work very similarly. // instead of
var items = document.getElementsByClassName('item');
for (var i=0; i<items.length; i++) {
interact(items[i]).draggable(...);
...
}
// you can do
interact('.item').draggable(...);
... |
Did any of the suggestions above solve your problem? |
Sorry for the delay. Yes, that fixed it! |
Turns out the fix worked for the Android tablet but not Ipad 3. |
Which fix did you use? |
The plunkr uses the master branch. I did clear the cache. Tried on safari & chrome. |
I meant that which of the things that I suggested did you try?
|
Hi Taye, I have a project where I can't seem to get the click event to fire properly. I can't post the source code at the moment because it isn't clean and to the point - but ultimately I have an un-ordered list element with images inside. The images have interact draggable assigned to them. The images also need to respond to the click event. But on mobile devices, the click event is ignored. Not globally - but only for elements that are draggable. So I attempted solution number 2, and replaced the click event with interact's tap event. However, now desktop is messed up. On the tap (or click) event I toggle an info window's visibility. I also register a one time document click event so that the info window will be toggled off if the user interacts with anything else on the page. Now, on desktop, this event seems to fire off immediately. It's as if the "tap" event triggers a "click" event directly after running, even though I have Any thoughts on what I might be fighting with? Do you think attaching the draggable event to the |
Hello!
Because the images are draggable, interact.js calls
Click events can't be prevented by calling interact(target).on('click', function (event) {
event.stopImmediatePropagation();
}, true /* useCapture */); |
If the browser supports the {add,remove}EventListener options object parameter, CSS touch-action and user-select can be used instead to prevent scrolling and text selection. With this change, clicks from touch events are no longer prevented on Browsers that support the options parameter: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Browser_compatibility Close #512, #517 Related to #58
hi all, interact('.navbar-nav').draggable(settings).on('tap', function (event) {
// because draggable blocks click event on touch, do manual trigger
var link = jQuery(event.target).closest('a');
if (link.exists() && event.pointerType === 'touch') {
jQuery(event.target).trigger('click');
}
}); |
thanks @seltix5 your solution helped me. i had to modify it slightly (closest() returns an array), but now anchors work in draggable components. |
Is there any permanent solution to this issue? The "fix" mentioned above stopped working after upgrading to v1.4.0 |
+1 @shubh3695 how did you figure it? |
Given that this issue was mostly on iOS, @tryhardest I had to capture "tap" events and filtered, ios device [detected by navigator], and then "click" the Element manually. it was a work-around, not a solution. I am no longer a part of that organization, where I did this 😄 , so dont remember it entirely, but yes, this was figured out after a long time. |
I'm closing this issue in favour of #859. |
A link inside a draggable element does not fire a click event when clicked.
checkout plunkr and click the link in the item.
Only seems to happen on touch devices. (ipad3 android).
The text was updated successfully, but these errors were encountered: