I
I
Ivan Lunin2021-07-06 19:00:22
css
Ivan Lunin, 2021-07-06 19:00:22

How to make the button border lit for only a few seconds?

I need to have a border on the button on the site every 4 seconds, how to do it rationally? It turned out that the yellow border appears and burns constantly

Here is the code

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
  <div class="container">
    <div class="scrollUp" id="scrollButton">
      <img src="https://static.thenounproject.com/png/486804-200.png">
      
    </div>
  </div>
    
  <script src="script.js"></script>
</body>
</html>


*{
  margin: 0;
  padding: 0;
  text-decoration: none;
}
.container{
  height: 1900px;
  background-color: crimson;
  width: 70%;
  margin: 0 auto;
}
.scrollUp{
  margin-left: 60%;
  margin-top: 4%;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background-color: #ffff;
  position: fixed;
}
.scrollUp img{
  align-items: center;
  width: 55px;
  height: 55px;
}


function yellow() {
  let buttonUp = document.getElementById('scrollButton').style.border = "3px solid yellow";
}

 setInterval(yellow, 3000);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JavaDev, 2021-07-06
@IvanLu

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question