jquery - Play specific html5 audio file if element is visible on screen -


i have set of animated elements move across div.

example here

<div class="static-parent">     <div class="animated-child animated-one"></div>     <div class="animated-child animated-two"></div> </div>  .static-parent{     height:10em;     width:20em;     background-color:red;     position:relative;        overflow:hidden; }  .animated-child{     height:5em;     width:5em;     position:absolute; }  .animated-one{     -webkit-animation: 5s moving linear infinite;      background-color:green; }  @-webkit-keyframes moving{     0% {         left:-5em;     }     100% {         left: -webkit-calc(100% + 5em);     }  }  .animated-two{     -webkit-animation: 5s moving-two linear infinite;     -webkit-animation-delay:2s;     background-color:blue;     left:-5em; }  @-webkit-keyframes moving-two{     0% {         left:-5em;     }     100% {         left: -webkit-calc(100% + 5em);     }  } 

when each of these elements enter div, play html5 audio file specific each animated element. blue , green squares contain different sounds. once these elements animate off of screen, sounds stop. etc etc...

can done in simple jquery? , -- thank in advance.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -