Adding last node while dragging
I am using the following code:
function deleteImage2($item)
{
$item.fadeOut(function()
{
var $list = $('ul',$albumcover).length ? $('ul',$albumcover) : $('<ul class="gallery ui-helper-reset"/>').appendTo($albumcover);
$item.appendTo($list).fadeIn();
});
}
"albumcover" is the name of the DIV and this code works fine, but I need to add the last node, how can I change this request?
respectfully
+2
source to share
1 answer
function deleteImage2($item)
{
$item.fadeOut(function()
{
var $list = ($('ul',$albumcover).length ? $('ul:last',$albumcover) : $('<ul class="gallery ui-helper-reset"/>')).appendTo($albumcover);
$item.appendTo($list).fadeIn();
});
}
add :last
to your selector to select only the last element
0
source to share