1

I would like to have a menu that slides in from the left and then vertically slides open, and closes by reversing those steps, sliding closed and then sliding away to the left.

I'm trying to use css transitions for this. I can get the menu to appear with a two step transition, but reversing doesn't work. According to other questions, reversing the steps should work, but for my specific case it does not. What is happening here?

Css

.menu-slide {
            position: absolute;
            width: 220px;
            top: 90px;                
            color: #fff;
            background: rgba(0, 0, 0, 0.60);
            overflow: hidden;
}
.open {
            transition: left 1s, max-height 1.5s 1s;  
            left: 55px !important;
            opacity: .80;
            max-height: 600px !important;
}

.closed {

           transition: max-height 1.5s, left 1s 1s;    
           left: -255px !important;
           opacity: 0;
           max-height: 20px !important;
}

Fiddle

1 Answer 1

1

The problem is you have set opacity: 0; on .closed set it to .80:

.closed {           
   transition: max-height 1.5s, left 1s 1s;    
   left: -255px !important;
   opacity: .80;
   max-height: 20px !important;
}

Your fiddle updated.

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

1 Comment

Thank you! I was going to add opacity to the transition, that's why it was even there.

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.