views:

9

answers:

0

Hi there,

I have sortable, draggable and click events binded to the same DOM element.

On sorting, I want the click event to be disabled.

I am using the following code for draggable, which works fine:

$('.selector').draggable({
    start: function(event, ui) {
    ui.helper.bind('click.prevent', function(event) {
        event.preventDefault(); 
    }); 
    },
    stop: function(event, ui) {
       setTimeout(function(){
           ui.helper.unbind('click.prevent');
       },1000);
    }
});

I got the above example while going through SF a while back.

However, the same code doesnt work when I use it for sortable.

I found out the reason being that the ui.helper is null for sortable's stop function.

Any way that i can prevent click event on sorting ?