NinjaOnSafari
NinjaOnSafari

Reputation: 1016

CSS3 transitions only works on the first element in Safari

I got a weird issue with my code at safari.
i created a jsbin and the issue is also there: http://jsbin.com/aseced/8/edit

Safari version: 5.1.7

Can you take a look? thx

TJL

EDIT:

the caption should come down(css3 rotateX and perspective) on mouseover. But only the first one animate it correct all the others just display (like display: block - none)

Here is my code from the demo on JSBin: (i just add the class open on mouseover to the article) HTML:

<article class="tile2x1">
  <img src="http://www.placehold.it/460x220" />
  <section class="caption" style="background-color: #">         
    <header>
      <h5>www.opten.ch</h5>
    </header>
    <a href="http://opten.ch" title="www.opten.ch">
      www.opten.ch
    </a>
  </section>
</article>
<article class="tile2x1">
  <img src="http://www.placehold.it/460x220" />
  <section class="caption" style="background-color: #">         
    <header>
      <h5>www.opten.ch</h5>
    </header>
    <a href="http://opten.ch" title="www.opten.ch">
      www.opten.ch
    </a>
  </section>
</article>
<article class="tile2x1">
  <img src="http://www.placehold.it/460x220" />
  <section class="caption" style="background-color: #">         
    <header>
      <h5>www.opten.ch</h5>
    </header>
    <a href="http://opten.ch" title="www.opten.ch">
      www.opten.ch
    </a>
  </section>
</article>

CSS:

[class*="tile"] {
  margin: 10px;
  position: relative;
  float: left;
  background-color: #e53b24;
}

.tile2x1 {
  height: 220px;
  width: 460px;
}

[class*="tile"] > section.caption {
  padding-top: 20px;
  width: 100%;
  position: absolute;
  top: 0px;
  left: 0px;
  background-color: #7ab73e;
  display: inline-block;

  transform-origin: top;
  -o-transform-origin: top;
  -moz-transform-origin: top;
  -webkit-transform-origin: top;

  transform: perspective( 600px ) rotateX( -91deg );
  -o-transform: perspective( 600px ) rotateX( -91deg );
  -moz-transform: perspective( 600px ) rotateX( -91deg );
  -webkit-transform: perspective( 600px ) rotateX( -91deg );

  transition: all .15s linear;
  -o-transition: all .15s linear;
  -moz-transition: all .15s linear;
  -webkit-transition: all .15s linear;


  backface-visibility: hidden;
  -webkit-backface-visibility: hidden; /* Chrome and Safari */
  -moz-backface-visibility: hidden; /* Firefox */
  -ms-backface-visibility: hidden; /* Internet Explorer */
}

[class*="tile"].open > section.caption {
  transform: perspective( 600px ) rotateX( 0deg );
  -o-transform: perspective( 600px ) rotateX( 0deg );
  -moz-transform: perspective( 600px ) rotateX( 0deg );
  -webkit-transform: perspective( 600px ) rotateX( 0deg );
}


[class*="tile"] > section.caption header {
  padding-bottom: 5px;
  font-size: 18px;
  text-transform: uppercase;
  color: #fff;
  font-weight: 100;
  line-height: 22px;
  margin: 0 20px;
  border-bottom: 1px solid #fffffd;
}

[class*="tile"] > section.caption > a {
  margin: 0 20px;
  line-height: 34px;
  color: #fff;
  font-weight: bold;
  display: block;
}

Upvotes: 2

Views: 431

Answers (1)

Pavel S.
Pavel S.

Reputation: 1027

I managed to fix this Safari pecularity by applying transform rules to the block that needs these transformations at the moment.

Unfortunately, in my case that was a bunch of slides moving left/right by scrolling the mousewheel, and there wasn't initial transform. It makes your case a little bit more complicated, as Safari apparently doesn't like when you specify transform for multiple blocks.

Here's your bin that I edited: I moved transform rules from [class*="tile"] > section.caption to [class*="tile"].open > section.caption and changed the rotation degree so that PoC is demonstrable.

Now it's your turn to devise a solution to make it work as intended.

Upvotes: 1

Related Questions