0

Fellows, I am using AJAX to delete an item from my table

var DeleteLink = function () {

   var LId = $("#HiddenLink_ID").val();

                $.ajax({

                    type: "POST",
                    url: "/my/DeleteLink",
                    data: { Link_ID: LId },
                    success: function (result) {

                        $("#row_" + LId).remove();

                    }

                })

            }

I am able to .remove the row with the ID

$("#row_" + LId).remove();

but what I want to do is to

Give it an animation such as slide left or slide right when deleted

Is it possible with my current code?

cheers

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
Ali
  • 2,702
  • 3
  • 32
  • 54

1 Answers1

0

Basically what you need to do is,

  1. Do an animation - Slide Left or Slide Right
  2. At the end of the animation, use the callback method to remove the item

Something like -

$("#row_" + LId).hide("slide", { direction: "left" }, 1000, function(){
     $("#row_" + LId).remove();
});

Read more - http://api.jqueryui.com/hide/

EDIT:

JS FIDDLE - https://jsfiddle.net/1t5wh5dv/1/ (jQuery 1.9 + ui)

JS FIDDLE - https://jsfiddle.net/1t5wh5dv/2/ (jQuery 3.2.1 + ui)

brainless coder
  • 6,310
  • 1
  • 20
  • 36