Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS3 transitions animation
    primarykey
    data
    text
    <p>I'm very new to CSS/HTML/JS so I don't have lots of experience with CSS transitions.</p> <p>I'm trying to animate a div elements on my page, but I can't achieve a desired result so far.</p> <p>Here is my problem: </p> <p>In my HTML I have a div container element that has 5 div elements inside of it. They look like simple boxes positioned in the middle of the screen and aren't visible for now. I also have 5 buttons in the corner of the screen. </p> <p>What I'm trying to do is:</p> <p>when I click a button (for example button 3) 3 of the divs on the left should disappear and be moved to the left behind the margin of the screen and 2 of the divs should do the same, but move to the right. After that I want 3 divs that are on the right slide back to the screen and 2 divs on the right should slide back as well. So it looks like they sliding towards each other to the positions they started from initially. </p> <p>I'm trying to do this effect using CSS transitions (transform: translateX(Npx);). So in my JS file I have something like this:</p> <pre><code>$(document).ready(function() { $(".button").click(function(){ // PART 1 // move 3 divs to the left using transform: translateX(Npx) (no animation) // move 2 divs to the left using transform: translateX(Npx) (no animation) // PART 2 // slide 3 divs to the left using transform: translateX(Npx) (with animation) // slide 2 divs to the left using transform: translateX(Npx) (with animation) }); </code></pre> <p>So the problem is that in this case <strong>only the part one works and part two seems to be not working</strong>.....if I attach the part on code to a different event...like another click button...it works just fine.</p> <p><strong>So my question is if these two transitions can be done under one event?!?!</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload