문제

HTML

<div class="container-screenz service-graphic sg2">
  <div class="screenz monitor">
        <img src="img/geoqueri-monitor.jpg">
  </div>
  <div class="laptop">
    <div class="screenz">
     <img src="img/geoqueri-laptop.jpg">
    </div>
    <div class="btm"></div>
  </div>
  <div class="phone">
    <div class="screenz">
     <img src="img/geoqueri-phone.jpg">
    </div>
  <div class="shadow"></div>        
  </div>
  <div class="ipad">
    <div class="screenz">
    <img src="img/geoqueri-tablet.jpg">
    </div>
  </div>
</div>

CSS (with added prefixes)

@keyframes scroll {
  20%,
  60% {
-webkit-transform:translateY(-62%);
-moz-transform:translateY(-62%);
 -ms-transform:translateY(-62%);
  -o-transform:translateY(-62%);
     transform:translateY(-62%);
       }
  80% {
    margin-top: -50px;
  }
}


.service-graphic {
  max-width: 42.500em;
  font-size: 8px;
  padding: 1em;
  position: relative;
  display: block;
  margin: 0 auto;

  .monitor {
    width: 28.750em;
    height: 17.5em;
    position: relative;
    background: #f8f8f8;
    border: 0.625em solid #1f1f1f;
    @include border-radius(0.625em);
    border: 1.25em solid #1f1f1f;
    margin: 0 auto;

    .content-screenz {
      width: 26.25em;
      height: 15em;
      left: 50%;
      margin-left: -13.125em;
      overflow: hidden;
    }

    &:before, &:after  {

      content: "";
      position: absolute;
      left: 50%;

    }

    &:before  {
      top: -0.25em;
      margin: -0.188em 0 0 -0.188em;
      width: 0.250em;
      height: 0.250em;
      @include border-radius(0.250em);
      background: #d8dbe1;
      top: -0.625em;

    }

  }

  .laptop {

  &:before  {
    content: "";
    position: absolute;
    left: 50%;
    top: -0.25em;
    margin: -0.188em 0 0 -0.188em;
    width: 0.250em;
    height: 0.250em;
    @include border-radius(0.250em);
    background: #d8dbe1;
    top: -0.625em;
  }

  }

}


.screenz  {
  &:after {
    width: 0.500em;
    height: 0.500em;
    @include border-radius(0.500em);
    margin: 0 0 -0.25em -0.25em;
    background: #e8ebf0;
    bottom: -0.625em;

  }
}

.monitor > div {
  position: absolute;

}



.monitor .content-screenz:before,
.laptop .screenz:before,
.phone .screenz:before,
.ipad .screenz:before {
  content: "";
  position: absolute;
  right: -5.625em;
  width: 12.500em;
  height: 18.750em;
  -webkit-transform:rotate(45deg);
  -moz-transform:rotate(45deg);
   -ms-transform:rotate(45deg);
    -o-transform:rotate(45deg);
       transform:rotate(45deg);

/*linear-gradient*/
background:-webkit-gradient(linear,left top,left bottom,color-stop(rgba(255, 255, 255, 0.5),0),color-stop(rgba(255, 255, 255, 0),1));
/*@@prefixmycss->No equivalent*/
background:-webkit-linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background:   -moz-linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background:     -o-linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background:        linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);

  z-index: 5;
}


.browser {
  width: 15em;
  height: 11.250em;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -5.625em 0 0 -7.5em;
  background: #ffffff;
  border: 1px solid #e8ebf0;
  border-top: 1.25em solid #d8dbe1;
  @include border-radius(0.313em);
}
.browser-content {
  overflow: hidden;
  height: 9.938em;
  padding-top: 0.625em;
}
.btns {
  position: absolute;
  top: -1.25em;
  left: 0.438em;

  &:before  {
      content: "";
      position: absolute;
      left: 2.188em;
      top: 0.313em;
      height: 0.625em;
      width: 11.563em;
      background: #fff;
      @include border-radius(3px);

  }
}


.btns > li {
  display: inline-block;
  list-style: none;
  width: 0.313em;
  height: 0.313em;
  @include border-radius(0.313em);
  background: #fc5254;
  margin-right: 0.250em;
}

.btns li:nth-child(2) {
  background: #fcae52;
}
.btns li:nth-child(3) {
  background: #66b34e;
}
.base {
  width: 5.625em;
  height: 3.1em;
  bottom: -3.9em;
  left: 50%;
  margin-left: -2.8125em;
  background: #e8ebf0;
  bottom: -4.3em;
  z-index: -1;
}
.base:before,
.base:after,
.grey-shadow:before,
.grey-shadow:after {
  content: "";
  position: absolute;
  top: 0;
}
.base:before {
  border-left: 0.813em solid transparent;
  border-right: 0px solid transparent;
  border-bottom: 3.125em solid #e8ebf0;
  left: -0.77em;
}
.base:after {
  border-right: 0.813em solid transparent;
  border-left: 0px solid transparent;
  border-bottom: 3.125em solid #e8ebf0;
  right: -0.77em;
}
.base > div {
  position: absolute;
}
.grey-shadow {
  width: 5.625em;
  height: 0.750em;
  background: #d8dbe1;
  top: 0;
}
.grey-shadow:before {
  border-left: 3px solid transparent;
  border-right: 0px solid transparent;
  border-bottom: 0.75em solid #d8dbe1;
  left: -3px;
}
.grey-shadow:after {
  border-right: 3px solid transparent;
  border-left: 0px solid transparent;
  border-bottom: 0.75em solid #d8dbe1;
  right: -2px;
  z-index: 1;
}
.foot {
  background: #e8ebf0;
}
.foot.top {
  width: 7.250em;
  height: 0.313em;
  bottom: -0.3em;
  left: 50%;
  margin-left: -3.625em;
}
.foot.top:before,
.foot.top:after,
.foot.bottom:before {
  content: "";
  position: absolute;
  top: 0px;
}
.foot.top:before {
  border-left: 16px solid transparent;
  border-right: 0px solid transparent;
  border-bottom: 5px solid #e8ebf0;
  left: -16px;
}
.foot.top:after {
  border-right: 1em solid transparent;
  border-left: 0px solid transparent;
  border-bottom: 5px solid #e8ebf0;
  right: -1em;
}
.foot.bottom {
  width: 9.375em;
  height: 0.313em;
  bottom: -0.625em;
  left: 50%;
  margin-left: -4.688em;
}
.laptop {
  width: 14.688em;
  height: 9.688em;
  background: #f8f8f8;
  border: 0.75em solid #1f1f1f;
-webkit-border-radius:10px 10px 0 0;
   -moz-border-radius:10px 10px 0 0;
        border-radius:10px 10px 0 0;  
  position: absolute;
  top: 14.5em;
  right: 1.875em;
  z-index: 10;
}
.laptop:before {
  top: -0.3em;
}
.laptop > div {
  position: absolute;
}
.laptop > .screenz {
  width: 13.188em;
  height: 8.188em;
  left: 0;
  margin-left: 0;
  background: #fff;
  overflow: hidden;
}
.btm {
  width: 18.500em;
  height: 0.625em;
  bottom: -1.188em;
  left: 50%;
  margin-left: -9.25em;
-webkit-border-radius:0 0 20px 20px;
-moz-border-radius:0 0 20px 20px;
  border-radius:0 0 20px 20px;
  background: #e8ebf0;
  z-index: 1;
}
.btm:before {
  content: "";
  position: absolute;
  width: 42px;
  height: 4px;
  left: 50%;
  top: 0;
  margin-left: -21px;
-webkit-border-radius:0 0 5px 5px;
-moz-border-radius:0 0 5px 5px;
     border-radius:0 0 5px 5px;
  background: #d8dbe1;
}
.btm:after {
  display: none;
  content: "";
  position: absolute;
  width: 100%;
  height: 0.25rem;
  background: #bababa;
  top: .5rem;
  border-bottom-right-radius: 7.5rem 2.5rem;
  border-bottom-left-radius: 7.5rem 2.5rem;
}
.phone {
  width: 4.125em;
  height: 8.750em;
  position: absolute;
  top: 15.75em;
  left: 1em;
  @include border-radius(0.5em);
  background: #1f1f1f;
  border: 1.563em solid #1f1f1f;
  border-left: 0.313em solid #1f1f1f;
  border-right: 0.313em solid #1f1f1f;
}
.phone:before,
.phone:after {
  content: "";
  position: absolute;
  left: 50%;
  background: #474e5d;
}
.phone:before {
  background: #474e5d;
  width: 1.250em;
  height: 0.250em;
  margin-left: -0.625em;
  top: -0.75em;
  @include border-radius(2px);
}
.phone:after {
  width: 0.625em;
  height: 0.625em;
  @include border-radius(0.625em);
  bottom: -1.125em;
  margin-left: -0.313em;
}

.phone .screenz {
  width: 3.50em;
  height: 5.625em;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: #fff;
}

.ipad {
  width: 8.75em;
  height: 12.750em;
  position: absolute;
  top: 11.7em;
  left: 6em;
  @include border-radius(0.5em);
  background: #1f1f1f;
  border: 1.563em solid #1f1f1f;
  border-left: 0.313em solid #1f1f1f;
  border-right: 0.313em solid #1f1f1f;
}
.ipad:before,
.ipad:after {
  content: "";
  position: absolute;
  left: 50%;
  background: #474e5d;
}
.ipad:before {
  background: #474e5d;
  width: 1.250em;
  height: 0.250em;
  margin-left: -0.625em;
  top: -0.75em;
  @include border-radius(2px);
}
.ipad:after {
  width: 0.625em;
  height: 0.625em;
  @include border-radius(0.625em);
  bottom: -1.125em;
  margin-left: -0.313em;
}
.ipad .screenz {
  width: 8em;
  height: 9.8em;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: #fff;
}
.ipad .content {
  width: 100%;
  left: 0%;
  margin-left: 0px;
}


.monitor , .laptop, .ipad, .phone  {
  overflow: hidden;

  img {
    padding: 0 !important;
    width: 100%;
    height: 880px;
-webkit-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
-moz-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
 -ms-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
  -o-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
     animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;

      &:hover {
      opacity: 1 !important;
    }

  }
}



@media screen and (min-width: 38em) {

  .service-graphic {
    font-size: 12px;
    .monitor {
      border: 1.25em solid #1f1f1f;
    }

  }

}

Original unmodified codepen :

http://codepen.io/nicholaspetersen/pen/BHjfk

So what I did was, I converted the LESS to CSS (since I do not know LESS) using http://less2css.org/

The animation worked perfectly for Firefox, however on Chrome it did not. So I went through the code and added all the missing prefixes, as you can see in the CSS code I provided and it still does not work. I am now clueless, why will this work on Firefox but not Chrome?

Thanks

도움이 되었습니까?

해결책

It's not enough to just add the prefixed transformations inside of a keyframe animation, you need to prefix the keyframe declaration itself as well. For example:

@-webkit-keyframes foo {
  0% {
    -webkit-transform: scale(0);
  }
  100% {
    -webkit-transform: scale(1);
  }
}

Also worth noting, you can view the compiled LESS in codepen by clicking on the 'eye' icon in the CSS pane. Hope this helps bud

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top