How to detect click but not drag using jQuery?
Similar to this: Can you detect "dragging" in jQuery?
You can use mousedown and mouseup to detect whether there was a drag.
$(function() {
var isDragging = false;
$(".conteiner")
.mousedown(function() {
$(window).mousemove(function() {
isDragging = true;
$(window).unbind("mousemove");
});
})
.mouseup(function() {
var wasDragging = isDragging;
isDragging = false;
$(window).unbind("mousemove");
if (!wasDragging) {
$(this).selection();
}
});
});
Here is the plunker demo: http://embed.plnkr.co/Y7mrOP/