28

I have applied -webkit-transform:rotateY(180deg); to flip an image. I am applying -webkit-transform:rotateY(0deg); to rotate it back to original position. Now I have some other classes to be applied, but when I check in Chrome Inspect Element I can see that rotateY(0) is still there which should be completely removed.

How can I remove the animation completely from an Element?

.transition
{
  -webkit-transform:rotateY(180deg);
  transform:rotateY(180deg);
}

.notransition {
  -webkit-transform:rotateY(0deg);
  transform:rotateY(0deg);
}
4
  • 2
    Take the class away from that element Commented May 13, 2013 at 8:15
  • You mean like this? Commented May 13, 2013 at 8:21
  • did the answer help you? accept the answer if it has helping you, or post your own answer. Commented Dec 4, 2015 at 14:58
  • Can you try transform=‘none’? Commented Feb 14, 2020 at 1:37

3 Answers 3

51

just do this:

.transition {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

.notransition {
  -webkit-transform: none;
  transform: none;
}

none seems to be the default value

Sign up to request clarification or add additional context in comments.

4 Comments

But what if I added both rotation and translation and would like to remove only one of them? E.g. I want to remove only rotation. Should I compute the undo value for the rotation and apply it in css then or is there a different way to achieve this?
transform accepts comma separated values, the order you specify both properties, is also the order you disable the properties. .transition { transform: rotateY(180deg), rotateX(180deg); } .notransition { transform: none, rotateX(180deg); }
Very important and useful. Thank you. Could you, please, provide a source which taught you this?
I correct my previous comment, it's not comma separated, it's space separated, background properties are comma separated. More info: here you go: developer.mozilla.org/en-US/docs/Web/CSS/transform
9
.transition {
    -webkit-transform:rotateY(180deg);
    transform:rotateY(180deg);
}

.notransition {
    -webkit-transform:unset;
    transform:unset;
}

4 Comments

Before answer the question, kindly check wtih the other answers. Don't post duplicate answers.
i have checked other answer and find incorrect because none is not working with transform, so before comment check all answer.
not sure why you have the downvote, but the 'unset' works for me
none is the default keyword: please refer to developer.mozilla.org/en-US/docs/Web/CSS/transform
1

In my case i needed a way to override an inline transform that was being setted by third party component and i didn't want it to remove it manually.

According to Mozilla documentation, you can only transform elements:

Only transformable elements can be transformed. That is, all elements whose layout is governed by the CSS box model except for: non-replaced inline boxes, table-column boxes, and table-column-group boxes.

So, you can disable transform by just modifing display to a non-element one, I changed it to display:inline so the transform stops working:

.transition {
    -webkit-transform:rotateY(180deg);
    transform:rotateY(180deg);
}
    
.notransition {
    display: inline;
}

Of course this will mess up with animation, however it's usefull when you are working with responsive CSS:

// small resolution / animation will stop working, and element will expand to the whole screen
.transition {
    -webkit-transform:rotateY(180deg);
    transform:rotateY(180deg);
}

.notransition {
    display: inline;
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
}

// medium resolution / animation works
@media print, screen and (min-width: 40em) {
    .notransition {
       -webkit-transform:unset;
        transform:unset;
    }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.