search

Home  >  Q&A  >  body text

Close popup before landscape transition

<p>My question is very simple. I have a popup that slides open from right to left and want it to slide closed from left to right. Currently I am able to open the popup correctly but cannot close it the way I expect. </p> <pre class="brush:php;toolbar:false;"><div class="overlay"> <div class="items-content"> <h1> hello </h1> </div> </div> .overlay { opacity: 0; transition: opacity 0.4s linear; } .overlay { &.-show { Opacity: 1 } } .overlay { .items-content { transform: translateX(200%); transition: transform 0.4s ease-in-out; } } .overlay { &.-show { .items-content { transform: translateX(0); transition: transform 0.4s ease-in-out; } } }</pre> <p>I've tried setting transparency, adding transition effects, transition delays, but nothing seems to work. </p>
P粉294954447P粉294954447470 days ago530

reply all(1)I'll reply

  • P粉276577460

    P粉2765774602023-08-17 15:45:22

    You need to reset the location, please try the following code:

    .overlay {
    &.-show {
       .items-content {
           transform: translateX(0); //  这里应该是0
           transition: transform 0.4s ease-in-out;
        }
    }

    }

    reply
    0
  • Cancelreply