JQuery如何实现爆炸动画

时间:2013-08-30 01:21:48

标签: jquery

我正在尝试使用来自JQuery UI的演示,我似乎无法将行为从fadeIn更改为爆炸。有人可以告诉我这里我做错了吗?

这是我到目前为止所拥有的。

$item.explode(function() {
  var $list = $("ul", $trash ).length ?
    $("ul", $trash) :
    $("<ul class='playlist ui-helper-reset'/>").appendTo($trash);

  $item.explode(function(){
    $item
      .animate({ width: "190px" })
      .animate({ height: "20px" });
  });
});

我所追求的是当物品被移动到垃圾箱时将其拆开并将它们完全移除而不是附加它们。

1 个答案:

答案 0 :(得分:0)

我能够通过添加以下内容来实现这一目标:

$(this).hide('explode', { "pieces":10 }, 1600, function() { $(this).remove; });

完整的功能现在看起来像这样:

  $item.explode(function(){
    $item
      .animate({ width: "190px" })
      .animate({ height: "20px" });
      $(this).hide('explode', { "pieces":10 }, 1600, function() { $(this).remove; });
  });