为什么 Animate marginLeft 不起作用?

Why does Animate marginLeft does not work?

我正在构建一个滑块,但动画 marginLeft 不起作用,我不明白为什么。

不透明度渐变也不起作用。

  $currentSlide.find('.content').animate({
    marginLeft: '-100%',
    opacity: 0
  }, speed);

  setTimeout(function() {
    $currentSlide.removeClass('active');
    $nextSlide.addClass('active');

    $nextSlide.find('.content').animate({
      marginLeft: '0%',
      opacity: 1
    }, speed);
  }, speed);

在这里您可以看到两张幻灯片($currentSlide 和 $nextSlide),其中第一张幻灯片应将 marginLeft 动画设置为 -100%,而第二张幻灯片应淡出,反之亦然。

[edit] 滑动点击白条

示例:https://codepen.io/anon/pen/dpNRqQ

[edit]:这个例子来自我,但应该行得通!

发现失败:

改变

$currentSlide.find('.content').animate

$currentSlide.find('.slide-content').animate