0

I want to change my box shadow from yellow to black and yellow again and just repeat that process. I don't mind if someone gives me a java script answer I just wanna know how to do it.

  • `window.addEventListener('load', function (e) {document.body.className += ' classThatInitiatesAnimations'});` and in your css, change `selector`s for animations to `.classThatInitiatesAnimations selector` – Paul S. Oct 06 '15 at 17:22

1 Answers1

6

How about a pure CSS solution?

.box {
    height: 200px;
    width: 200px;
    background: #CCC;
    animation-duration: 2s;
    animation-name: changeShadow;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}
@keyframes changeShadow {
    from {
        box-shadow: 0px 4px 8px black;
    }
    to {
        box-shadow: 0px 4px 8px yellow;
    }
}
<div class="box"></div>
Ramiz Wachtler
  • 5,623
  • 2
  • 28
  • 33