RamonSmit / Nestable2

New pickup of Nestable!
Other
322 stars 147 forks source link

Add fadeOut for remove method #70

Closed RomanBurunkov closed 7 years ago

RomanBurunkov commented 7 years ago

This adds option 'fade' for remove method, which fadeOut an item before removing it from list.

RamonSmit commented 7 years ago

LGTM, @pjona what do you think? :-)

pjona commented 7 years ago

@RomanBurunkov @RamonSmit maybe better solution is to give user some callback, so he can also use for example slideUp() with his duration time. What you think about it?

pjona commented 7 years ago

@RomanBurunkov I can help you with it, but I need more time to prepare some example.

RamonSmit commented 7 years ago

@pjona didn't think of that before. But that sounds like a good idea :+1:

RomanBurunkov commented 7 years ago

@pjona, do you mean adding callback as a parameter during invoke remove method?

But we also can add some additional methods for hiding with my approach and also add time var...

Adding callback can be more comprehensive, but adding several hiding types and time variable is simplier to use:

$('#nest').nestable('remove', 'fade', 300);
$('#nest').nestable('remove', 'slide', 300);

//Use default time
$('#nest').nestable('remove', 'fade');
$('#nest').nestable('remove', 'slide');

or

$('#nest').nestable('remove', function(item){
   ....
});

Or we can add both options available and even default behavior defined at plugin initialization, which can be changed when invoking remove with parameters.

@pjona , @RamonSmit what do u think, guys?

pjona commented 7 years ago

@RomanBurunkov I think solution with 3 parameters fits enough:

$('#nest').nestable('remove', 'fade', 300);
$('#nest').nestable('remove', 'slide', 300);