0

Hey i've set a toggle event on an element and i wish to remove it somewhere in the code.

How can i remove this?

This is my toggle :

$('#album_cell'+currentCell).toggle(function() {                                    

                    $('#album_cell'+currentCell).flip({
                    direction:'lr',
                    dontChangeColor: true,
                    content: captionPane
                    });
                        }, function() {
                    $('#album_cell'+currentCell).revertFlip();
                    });

flip is a plugin i'm using, unrelated to the problem.

I can't seem to be able to use something like :

$('#album_cell'+currentCell).off('toggle');

So how can i disable it? could i set both of the toggle events as some variables and disable it then?

eric.itzhak
  • 14,702
  • 26
  • 83
  • 137

1 Answers1

2

Because 'toggle' is action and not event. Try to remove 'click' event. See Best way to remove an event handler in jQuery?

$('#album_cell'+currentCell).off('click');

See also examples JQuery.off to disable specific action.

Community
  • 1
  • 1
Anton Bessonov
  • 6,992
  • 3
  • 29
  • 33