/    Sign up×
Community /Pin to ProfileBookmark

CSS Border Animation

Hi, I have a css border than I am animating around a box. As shown here https://codepen.io/jeremydricard/pen/MdPaRY
there are 2 animations in essence.

The first one loops an infinite border around the box every 5 seconds in a circle (or square) motion.
The second is triggered when the mouse hovers on top of the square. Starting the second animation which just acts like a focus and highlights the square and the first animation is removed.
Upon when the box is removed from hover state it should go back to animation 1 loop.

However whats happening is after it hovers once animation 2 is triggered, then animation 1 after mouse out, but when hovered again the animation 1 isn’t being stopped.

The process i used was jquery .addClass and .removeClass for these animation classes.
Can someone take a look at the code for me and provide any input? Thank you!

to post a comment
CSSHTMLJavaScript

0Be the first to comment 😎

×

Success!

Help @jeremydricard spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...