r/webdev • • Jan 18 '23

CSS flex for speed learners.

6.5k Upvotes

100 comments sorted by

View all comments

159

u/The_Egg_came_first Jan 18 '23

Source: https://semicolon.dev/tutorial/css/justify-content-examples

Oh my, that's how they made the bouncy animation:

jQuery( document ).ready(f=>{
  setTimeout(e => {
    jQuery('table').animate({width: '450px'}, 2000, 'easeOutBounce').animate({width: '100%'}, 2000, 'easeOutBounce').animate({width: '450px'}, 2000, 'easeOutBounce').animate({width: '100%'}, 2000, 'easeOutBounce').animate({width: '450px'}, 2000, 'easeOutBounce').animate({width: '100%'}, 2000, 'easeOutBounce').animate({width: '450px'}, 2000, 'easeOutBounce').animate({width: '100%'}, 2000, 'easeOutBounce');
  }, 1000)
});

Anyways, here's my quick fix: https://i.imgur.com/PhzeOKq.gif

72

u/Isaynotoeverything Jan 18 '23

Could do this in pure CSS couldn't you 🤔

54

u/stupidcookface Jan 18 '23

Yea with @keyframes

6

u/arhythm Jan 19 '23

I really need to learn more css like this.

0

u/[deleted] Jan 19 '23

[deleted]

0

u/[deleted] Jan 19 '23

[deleted]

1

u/Ambitious_Yak_5257 Jan 19 '23 edited Jan 19 '23

Then you gotta use the transition property and set the yellow background as a state.
It may be a native state with a pseudo-selector like :hover and :focus, or a custom state setting a class to the element with JavaScript:

a {
background-color: red;
transition: background-color 0.15s;
}

a:hover {
background-color: yellow;
}

a.has-warning {
background-color: yellow;
}

1

u/Candyvanmanstan Jan 19 '23

No.

u/Amphibian_Upbeat, you could use the

animation-iteration-count: 1;

property. It, and other properties are mentioned in the link I mentioned in my previous comment.