I have a draggable icon that opens a popup when clicked, but it opens the popup if you drag the icon and then let go of the mouse button. I need to stop this from happening.
I had this figured out but messed up my code. If someone can adjust my code below to stop the click happening after drag, that would be super helpful!
jQuery(document).ready(function($) {
$(function() {
$(".icon").draggable({
containment: "#containment-wrapper",
stop: function(e, ui) {
var perc = ui.position.left / ui.helper.parent().width() * 100;
ui.helper.css('left', perc + '%');
}
})
$("[data-popup]").on('click', function() {
var target = $(this).data('popup');
target = "#" + target;
var $targetEl = $(target)
$targetEl.show();
$targetEl.css('zIndex', popupZIndex);
popupZIndex += 1;
});
});
});