css3 - Hover over one div and it effects another -


so want hover on box , have activate div easing effects. can see below .images{} has 0s infinite scroll, , .box:hover > .images{} when change 0s 10s start slideshow.

html:

<div class="slideshow">      <div class="images"></div>      <div class="box"></div>    </div> 

css:

.slideshow {   position: relative;   overflow: hidden;   height: 220px;   width: 100%; } .box { width:100px; height:100px; position: absolute; left: 0; top: 0; background-color: #333; }  .images {   background: url('http://jamesebeling.com/testing/jamesebeling/wp-content/uploads/2013/08/buildings.png');   position: absolute;   left: 0;   top: 0;   height: 100%;   width: 300%;  -webkit-transition: 1s ease-out;   -moz-transition: 1s ease-out;   -o-transition: 1s ease-out;   transition: 1s ease-out;   -webkit-animation: slideshow 0s linear infinite;   -moz-animation:    slideshow 0s linear infinite; } @-webkit-keyframes slideshow {   0%    { left: 0; }   100%  { left: -200%; } } @moz-keyframes slideshow {   0%    { left: 0; }   100%  { left: -200%; } } /* hey browser, use gpu */    -webkit-transform: translate3d(0, 0, 0); }  @-webkit-keyframes moveslideshow {     0%   {          -webkit-transform: translatex(0);       }         100% {          -webkit-transform: translatex(-200%);       } } @-moz-keyframes moveslideshow {     0%   {          -moz-transform:    translatex(0);      }         100% {          -moz-transform:    translatex(-200%);      } }  .box:hover > .images { .images {   background: url('http://jamesebeling.com/testing/jamesebeling/wp-content/uploads/2013/08/buildings.png');   position: absolute;   left: 0;   top: 0;   height: 100%;   width: 300%;  -webkit-transition: 1s ease-out;   -moz-transition: 1s ease-out;   -o-transition: 1s ease-out;   transition: 1s ease-out;   -webkit-animation: slideshow 10s linear infinite;   -moz-animation:    slideshow 10s linear infinite; } @-webkit-keyframes slideshow {   0%    { left: 0; }   100%  { left: -200%; } } @moz-keyframes slideshow {   0%    { left: 0; }   100%  { left: -200%; } } /* hey browser, use gpu */    -webkit-transform: translate3d(0, 0, 0); }  @-webkit-keyframes moveslideshow {     0%   {          -webkit-transform: translatex(0);       }         100% {          -webkit-transform: translatex(-200%);       } } @-moz-keyframes moveslideshow {     0%   {          -moz-transform:    translatex(0);      }         100% {          -moz-transform:    translatex(-200%);      } } 

if change html include box class before images class, can use adjacent selector select .images when it's preceded .box:hover:

.box:hover + .images { ... } 

working demo.

i added z-index: 1 .box sits on top of images element.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -