Can someone help me fix this code, please?
What I want is to block the live ('click'
) function until the sliddingright
function is done.
('li.menu-item').live('click', function(event){
if( !$(this).is(':animated'))
{
sliddingright(page_id_target_right,previous_right_old,previous_right,next_right,pages_numbers);
}
});
Just add a return statement to your slidingright function that returns 'standby' once the function has completed its task, save it and check its value next time 'click' is called.
Like so :
var state = 'standby';
('li.menu-item').live('click', function(event){
if( !$(this).is(':animated') && state == 'standby' )
{
state = 'processing';
state = sliddingright(page_id_target_right,previous_right_old,previous_right,next_right,pages_numbers);
}
});