Share Posted January 30, 2019 Hello ! The summary : I would like to create an animation when I hover an element in a list. My codepen : On hover on the <li>, I get the index of this and I animate the element with the same index in another <div>. My codepen works but when I hover the elements quickly, the animation is broken. I found this codepen : See the Pen emxWYb by MAW (@MAW) on CodePen But this only works for elements in the items hover. How I can I do a nice animation ? Thanks a lot ! See the Pen aXBwPQ by anon (@anon) on CodePen Link to comment Share on other sites More sharing options...
Share Posted January 30, 2019 Hi @gbrl, you were pretty close! For these types of one-on-one interactions, it's often easier just to build a tween to respond rather than build out a timeline. Here is a CodePen showing what I mean. Also, animating top (and/or left) is perfectly fine, but performance is better if you animate the x/y properties since these use CSS translate. See the Pen xMRWrz by sgorneau (@sgorneau) on CodePen Hope this helps! 4 Link to comment Share on other sites More sharing options...
Author Share Posted January 30, 2019 Hi @Shaun Gorneau ! Amazing ! It's exactly what I need ! Thanks a lot for your help 2 Link to comment Share on other sites More sharing options...
Share Posted January 30, 2019 Happy to help! 1 Link to comment Share on other sites More sharing options...
Share Posted February 3, 2019 Hi, Here's a suggestion for an alternative concept ... With a quick mouse movement it feels more comfortable - so my feeling, when the 'last / previous' motif runs out of the window upwards. This example with 'mouseenter' and the 'last' motif remains in its position. See the Pen GzmQEr by mikeK (@mikeK) on CodePen Happy tweening ... Mikel 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now