触摸事件在动画关键帧 CSS IOS 14 中不起作用

发布于 2025-01-18 04:09:31 字数 963 浏览 2 评论 0原文

我尝试在动画内容向左运行时阻止按住拖动,以便使用触摸动作时动画不会卡住,但是当我在 IOS 14 Webview 中测试时,触摸-action 似乎无法正常工作。有什么见解吗?

.wrapper {
  position: relative;
  width: 300px
  height: 100vh;
}

.content-box {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 300px;
    height: 500px;
    background: green;
    animation: ctl-noTouch 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); 
}

@keyframes ctl-noTouch {
  0% {
      transform: translateX(40px); 
      touch-action: none;
  }
  99% {
      transform: translateX(0px); 
      touch-action: none;
  }
  100% {
      transform: translateX(0px); 
      touch-action: auto;
  }
}
<div class='wrapper'>
  <div class='content-box'>
    Content to left
  </div>
</div>

I try to prevent hold drag when animation content to left is running so the animation not stuck using touch-action, but when i test in IOS 14 Webview, touch-action seem not working properly. Any insight?

.wrapper {
  position: relative;
  width: 300px
  height: 100vh;
}

.content-box {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 300px;
    height: 500px;
    background: green;
    animation: ctl-noTouch 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); 
}

@keyframes ctl-noTouch {
  0% {
      transform: translateX(40px); 
      touch-action: none;
  }
  99% {
      transform: translateX(0px); 
      touch-action: none;
  }
  100% {
      transform: translateX(0px); 
      touch-action: auto;
  }
}
<div class='wrapper'>
  <div class='content-box'>
    Content to left
  </div>
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文