jquery - Enhancing performance of a gif background rollover -


i made cool rollover in css display animate gif when parent hovered.

here's code : http://codepen.io/clemeeent/pen/oggzma

problem have 40 .day that, playing animate gif behind circle @ time. i'm not sure browser/computer/connection can handle much. tried figure out solution :

$( ".day" ).mouseenter(function() {   $( ".play" ).append( "<img src="http://media.giphy.com/media/5vb7xqb7z3sce/giphy.gif">" ); }); 

but i'm definitly not sure better...

if idea enhance code, appreciated.

ps : gif sample, final result great :p

as mentioned in comments above

do css

img {      border-radius:50%;  }  .day {      margin: 15px;      height: 90px;      width: 90px;      float: left;      position: relative;      cursor: pointer;  }  .play {      height: 90px;      position: absolute;      width: 90px;      left: 50%;      top: 50%;      margin: -45px 0 0 -45px;      z-index: -1;      transition-duration: 100ms;      transition-timing-function: ease-in-out;      -moz-transition-property: all;      -moz-transition-duration: 100ms;      -moz-transition-timing-function: ease-in-out;      -webkit-transition-property: all;      -webkit-transition-duration: 100ms;      -webkit-transition-timing-function: ease-in-out;      -o-transition-property: all;      -o-transition-duration: 100ms;      -o-transition-timing-function: ease-in-out;  }  .play img {      width: 100%;      border-radius: 50%;  }  .badge {      height: 35px;      width: 35px;      background: #ed2c27;      border-radius: 50%;      font-size: 18px;      position: absolute;      top: 0;      right: 0;      text-align: center;      font-family:'satisfy', cursive;  }  .day:hover .spinner {      position: absolute;      display: block;      height: 95px;      width: 95px;      left: -5px;      top: -5px;      border-radius: 50%;      border: 3px solid transparent;      border-top-color: black;      -webkit-animation: spin 2s linear infinite;      animation: spin 2s linear infinite;  }  .day:hover .spinner:before {      content:"";      position: absolute;      top: 0px;      left: 0px;      right: 0px;      bottom: 0px;      border-radius: 50%;      border: 3px solid transparent;      border-top-color: black;      -webkit-animation: spin 3s linear infinite;      animation: spin 3s linear infinite;  }  .day:hover .spinner:after {      content:"";      position: absolute;      top: 3px;      left: 3px;      right: 3px;      bottom: 3px;      border-radius: 50%;      border: 3px solid transparent;      border-top-color: black;      -webkit-animation: spin 1.5s linear infinite;      animation: spin 1.5s linear infinite;  }  @-webkit-keyframes spin {      0% {          -webkit-transform: rotate(0deg);          -ms-transform: rotate(0deg);          transform: rotate(0deg);      }      100% {          -webkit-transform: rotate(360deg);          -ms-transform: rotate(360deg);          transform: rotate(360deg);      }  }  @keyframes spin {      0% {          -webkit-transform: rotate(0deg);          -ms-transform: rotate(0deg);          transform: rotate(0deg);      }      100% {          -webkit-transform: rotate(360deg);          -ms-transform: rotate(360deg);          transform: rotate(360deg);      }  }
<div class="day">      <!-- 1 -->      <div class="spinner"></div>      <img data-src="holder.js/90x90" class="img-circle" style="width: 90px; height: 90px; background-color:#d3d3d3;" /> <span class="badge">1</span>    </div>


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -