jquery fadeOut complete got error: fadeOut(...).complete is not a function

jquery fadeOut complete got error: fadeOut(...).complete is not a function

我正在尝试这个:

var notifications = $( "#notifications" );
  notifications.fadeOut("slow")
  .complete(function () {
      alert('completed');
  });

但我得到:未捕获的类型错误:notifications.fadeOut(...).complete 不是一个函数

参考:http://api.jquery.com/fadeout/

有两种方法可以指定 on-complete-callback:

通过第二个参数:

var notifications = $( "#notifications" );
notifications.fadeOut("slow", function () {
    alert('completed');
});

或通过选项:

var notifications = $( "#notifications" );
notifications.fadeOut({
    duration: "slow",
    complete: function () {
      alert('completed');
    }
});