jqueryrepeaterjquery.repeater

How to execute the next code only after the slideUp is complete in jquery.repeater


This is the original code

$(this).slideUp(deleteElement);
itemRemove();

The above code calls itemRemove() before the slideUp is complete. So I used callback function as below

$(this).slideUp( deleteElement, function() {
    itemRemove();
});

But this affects the indexing functionality of the repeater(does not decrement the repeater name indexes as the original repeater.


Solution

  • Probably not the best way, but this is how I solved my problem:

    $(this).slideUp(deleteElement);
    setTimeout(function(){ itemRemove(); }, 2000);
    

    This code works because the slideUp is complete before 2 seconds. Would love to find the proper way tho, that is as soon as the slideUp is complete.