Skip to content

CSS transitions do not always work #7781

Closed

Description

@paulrouget
<style>
  div {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: red;
    transition: transform 400ms linear;
    transform: translateX(400px);
  }
  .show div {
    transform: translateX(0);
  }
</style>

<div></div>
<pre></pre>


<script>
  var show = false;
  setInterval(() => {
    show = !show;
    document.body.classList.toggle('show', show);
    document.querySelector('pre').textContent = show;
  }, 1000);
</script>

This code is supposed to show and hide a red panel by changing its transform attribute.

Running this code in Servo, the transition works from translateX(400px) to translateX(0), but not in reverse. And after ~5 seconds, nothing is animated anymore, the screen stays blank.

Activity

  1. added
    A-content/css
    on Sep 29, 2015
  2. paulrouget commented on Oct 19, 2015

    @paulrouget
    ContributorAuthor

    This is a dupe of #7816

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/css

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions