Reputation: 1500
I'm playing around with CSS 3D animations and I've hit a strange problem.
Created a card which has two sides, front and back, both images.
The first time the card flips to show the back card it does not do it smoothly, you see the first card spinning around and then you see nothing for a split second and then the back card just snaps into view.
It's only the first flip that's wrong, all other flips after it look smooth and exactly what I'm looking for.
That the back image was not loaded yet by the time the first flip happened. I tried to preload the image with JS
but it did nothing.
It's very annoying and I'd like to hear anyway I can fix this. I've even thrown in every vendor prefix in the CSS but it changed nothing.
I just tested it in FF30 and it seems to work. It does not work in my Chrome 36.0.1985.125.
Upvotes: 3
Views: 1545
Reputation: 2591
It looks like putting the images as css-background-images works in Chrome and FF.
Not sure if there are any drawbacks to using this method on other parts of your project though...
HTML
<div id="card">
<div class="card-side front-card"></div>
<div class="card-side back-card"></div>
</div>
CSS
.front-card {
background: url(http://images.wisegeek.com/planet-earth.jpg);
}
.back-card {
background: url(http://haughtonmarsproject.com/wp-content/uploads/2013/11/Mars-1-Project.jpg);
}
Upvotes: 2