Closed silviascript closed 9 years ago
I think it's because your animation takes 1 second to complete - https://github.com/siltastic/trivia-game/blob/f4061deed77cfd28f5f50e9ccb7e1c91a7b01421/css/styles.css#L165
Try using setTimeout or listening for the animation's end before removing the class - http://blog.teamtreehouse.com/using-jquery-to-detect-when-css3-animations-and-transitions-end
Closing for now since I'm pretty sure Jesse's suggestion is correct, but @siltastic, we can pair on this during part of our one-on-one today if you'd like.
https://github.com/siltastic/trivia-game/blob/master/js/main.js#L60-L97
After exploring with adding and removing classes through jQuery, I was able to achieve half of my goal. My goal was to have my trivia questions slide in from the right, then slide to the left and disappear when the user clicked on an answer. I also wanted to remove the trivia questions in my html to be replaced with the next question (it works). Unfortunately, I broke my click event function and only half my animation is working. The function won't loop through my correct answers array after the first question and won't visibly show animating to the left. I've tried using a ".delay()"; which helped to show the animation, but created an issue. I refactored my code and solved many minor issues, but the main one was my click event function.