For example, if you go to this link it flashes the answer temporarily.
How is this implemented?
Is this some bootstrap/css thing?
I tried googling, but I don't know what this flashing highlight functionality is called.
For example, if you go to this link it flashes the answer temporarily.
How is this implemented?
Is this some bootstrap/css thing?
I tried googling, but I don't know what this flashing highlight functionality is called.
You could achieve that using css animation
, try as below,
div{
width:100%;
height:auto;
animation:bg 2s ease-in;
-webkit-animation:bg 2s ease-in;
-moz-animation:bg 2s ease-in;
-ms-animation:bg 2s ease-in;
-o-animation:bg 2s ease-in;
}
@-webkit-keyframes bg{
0%{
background:rgba(255,165,0,1);
}
20%{
background:rgba(255,165,0,0.8);
}
50% 70%{
background:rgba(255,165,0,0.5);
}
100%{
background:rgba(255,165,0,0);
}
}
@-moz-keyframes bg{
0%{
background:rgba(255,165,0,1);
}
20%{
background:rgba(255,165,0,0.8);
}
50% 70%{
background:rgba(255,165,0,0.5);
}
100%{
background:rgba(255,165,0,0);
}
}
@-ms-keyframes bg{
0%{
background:rgba(255,165,0,1);
}
20%{
background:rgba(255,165,0,0.8);
}
50% 70%{
background:rgba(255,165,0,0.5);
}
100%{
background:rgba(255,165,0,0);
}
}
@-o-keyframes bg{
0%{
background:rgba(255,165,0,1);
}
20%{
background:rgba(255,165,0,0.8);
}
50% 70%{
background:rgba(255,165,0,0.5);
}
100%{
background:rgba(255,165,0,0);
}
}
<div>
<p>
Dummy Content Dummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy ContentDummy Content
</p>
</div>
This can be implemented with JavaScript.
var bgopacity = 1.0;
var bgfade = function() {
var comment = document.getElementById("comment");
bgopacity -= 0.02;
comment.style.backgroundColor = "rgba(255, 242, 130, " + bgopacity + ")";
if (bgopacity >= 0) {
setTimeout(bgfade, 30);
}
}
bgfade();
This can be achieved with css3 animations..
see demo here
var answer=document.createElement('div');
answer.innerHTML='<div id="answer">\
<h1>\
My answer\
</h1>\
</div>'
setTimeout(function(){document.body.appendChild(answer)},3000)
@keyframes animate {
from {
background: transparent
}
50% {
background: #f2e68e;
}
100% {
background: transparent;
}
}
@-webkit-keyframes animate {
from {
background: transparent;
}
50% {
background: #f2e68e;
}
100% {
background: transparent;
}
}
@-o-keyframes animate {
from {
background: transparent;
}
50% {
background: #f2e68e;
}
100% {
background: transparent;
}
}
#answer {
animation-name: animate;
animation-duration: 3s;
animation-iteration-count: 1;
-moz-animation-name: animate;
-moz-animation-duration: 3s;
-moz-animation-iteration-count: 1;
-o-animation-name: animate;
-o-animation-duration: 3s;
-o-animation-iteration-count: 1;
-webkit-animation-name: animate;
-webkit-animation-duration: 3s;
-webkit-animation-iteration-count: 1;
}
<div>
Please wait I will inject this answer and hightlight it</div>
This is called the yellow fade technique, there is already a question on SO for this: Yellow fade effect with JQuery and here is also some more info on this: https://signalvnoise.com/archives/000558.php To jump to a section and highlight it you can use :target More info on this here: https://css-tricks.com/on-target/