Please give the blinking frame code on pure javascript. I can not find anywhere.
Closed due to the fact that the essence of the issue is incomprehensible by the participants Alexey Shimansky , fori1ton , Dmitriy Simushev , aleksandr barakin , Denis Bubnov Jan 21, 17 at 17:28 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
- What does the blinking frame mean? and where does the javascript? - Grundy
- can a border make a fluttering - L. Vadim
|
2 answers
setInterval(function() { if (document.getElementById("myborder").className == "noact") { document.getElementById("myborder").className = "active"; } else { document.getElementById("myborder").className = "noact" } }, 1000); #myborder { width: 400px; height: 50vh; } .active { border:5px solid red; } .noact { border:5px solid yellow; } <div id="myborder" class="active"></div> |
Option 1 - Javascript
setTimeout(function() { setInterval(function() { document.getElementsByClassName("b-border")[0].style.borderColor = "gray"; }, 1000); }, 500); setInterval(function() { document.getElementsByClassName("b-border")[0].style.borderColor = "green"; }, 1000); .b-border { border: 5px solid gray; width: 150px; height: 150px; } <div class="b-border"></div> Option 2 - CSS
.b-border { border: 5px solid gray; width: 150px; height: 150px; animation: animBlinkBorder 1s linear infinite; } @keyframes animBlinkBorder { 0% { border-color: gray; } 50% { border-color: transparent; } 100% { border-color: gray; } } <div class="b-border"></div> |