search

Home  >  Q&A  >  body text

jquery - 移动端如何写弹性效果

在这个网页的第2个例子【自适应 / 全屏 + 分页】中
http://www.swiper.com.cn/demo/index.html
如果按住鼠标向右拖动,会发现可以拖动,然后放开鼠标,就会"弹"回去,观察代码发现,是用了下面这个css3代码
transition-duration: 0ms; transform: translate3d(86.6443px, 0px, 0px);
那么问题来了,这个拖拉后弹回去的js效果要怎么写呢?哪位大神有思路?提供一下啦。谢谢!

黄舟黄舟2779 days ago573

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 11:43:39

    Add css3 transition animation to the element. The value of the transition animation is the x-axis of transform3d. The distance dragged by the finger is the value of the x-axis. When the finger is released, the x-axis value is restored, which is 0px

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 11:43:39

    See if the API has a sliding effect or write an animation yourself. It is nothing more than adjusting the Bezier curve to appear in the cache

    reply
    0
  • Cancelreply