Disabling click/touch on certain elements
See original GitHub issueI’ve added a scrubber and using it like so:
scrubber.onValueChanged = function (value) {
gallery.goTo(value);
};
gallery.listen('afterChange', function() { scrubber.value(gallery.getCurrentIndex()); });
gallery.listen('close', function() { $('.pswp__scrubber').empty(); });
… it seems to work well except that when I’m interacting with the scrubber, PS slides the images. How do I disable slide/drag only on the .pswp__scrubber element?
I tried this, but the slides still “shake” when I use the scrubber:
gallery.listen('preventDragEvent', function(e, isDown, preventObj) {
if ( $(".thumb.dragging") ) {
console.log(1);
isDown = false;
preventObj.prevent = true;
}
});
(the scrubber handle has class dragging while its being used)
EDIT:
Also tried:
gallery.listen('preventDragEvent', function(e, isDown, preventObj) {
if (e.target.className === "scrubber" || e.target.className === "track" || e.target.className === "thumb" ) {
isDown = false;
preventObj.prevent = true;
console.log(e.target.className);
}
});
… but its the same.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to disable / re-enable all click/touch/mouse events on an ...
When a certain link in the parent element is clicked, I'm trying to fade it 50% and disable any further interaction with it...
Read more >How to Disable Force Click on MacBook Trackpads - OSXDaily
Turning Off Force Click (3D Touch) on Mac TrackPad ... use a firm click when selecting and clicking items as they use the...
Read more >How to Enable or disable context menu items in Angular ...
You can enable and disable the menu items using the enableItems method in ContextMenu. To enable menuItems, set the enable property in argument...
Read more >Customize the Touch Bar on Mac - Apple Support
For some apps, you can customize the Touch Bar so that it contains buttons ... click Keyboard in the sidebar, then click Touch...
Read more >Enhancing The Clickable Area Size - Ahmad Shadeed
The idea is that a pseudo element belongs to its parent, so when we create one with a specific width and height, it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@namespace-dave yep, that’s correct, I was typing the same thing before I saw your edit
@dimsemenov do you have an example for the best approach to unbindpointerdown
from.pswp__scroll-wrap
?UPDATE:
If you are looking to prevent the
pointerDown
event from firing on specific elements contained within the.pswp__scroll-wrap
element. you can do this using the custompointerDown
event hat is dispatched on the scroll wrap; see here .If you add an event listener for that custom event, carry out a check, and then
event.preventDefault()
it will work as desired.