As suggested in my comment you can add a class to the element (eg dragging
) when you start dragging in the start
function of the draggable, than check in the click handler if the element (or the parent of it in your case) have to class or alternatively fire the function.
Code:
$(document).ready(function () {
$('.container').draggable({
start: function (event, ui) {
$(this).addClass('dragging');
}
});
$('.clickable').click(function (event) {
if ($(this).parent().hasClass('dragging')) {
$(this).parent().removeClass('dragging');
} else {
//alert("real click");
$("#content").toggle();
}
});
});
Maybe there are alternatives to this, but is the only solution that I used.
Demo: http://jsfiddle.net/IrvinDominin/N3bKb/
Docs: