admin管理员组文章数量:1316363
So I need to create a flipping image almost exactly like this.
But the difference is what if I want several buttons and each one flips to a specific face. Lets say I want 4 buttons labelled 1, 2, 3 and 4, and I want 4 different card faces, each a different color with the corresponding number on the face. So the page will load with face 1 showing and clicking on button 1 will do nothing, but clicking on button 3 will flip to a face showing the number 3 and so on etc etc. Any ideas?
So I need to create a flipping image almost exactly like this.
But the difference is what if I want several buttons and each one flips to a specific face. Lets say I want 4 buttons labelled 1, 2, 3 and 4, and I want 4 different card faces, each a different color with the corresponding number on the face. So the page will load with face 1 showing and clicking on button 1 will do nothing, but clicking on button 3 will flip to a face showing the number 3 and so on etc etc. Any ideas?
Share Improve this question edited Mar 12, 2013 at 1:42 Matt Coughlin 18.9k3 gold badges47 silver badges59 bronze badges asked Mar 11, 2013 at 16:52 Louden100Louden100 532 silver badges5 bronze badges 1- If you want it CSS-only, that's going to require a lot of otherwise unnecessary markup. With a JavaScript solution (that's still using CSS 3D transforms and CSS transitions) it gets a lot easier. – Ana Commented Mar 11, 2013 at 18:34
1 Answer
Reset to default 9Simple solution
Start with the same approach as in the online example you mentioned in the question, but before starting the rotation, replace the contents of the "back side" with the contents of the element you want to rotate into view.
The contents of each element should be stored separately in the HTML, and retrieved when needed.
<div class="container">
<div class="card">
<div class="face face1"></div>
<div class="face face2"></div>
</div>
<ul class="store">
<li>
<div class="content content1">1</div>
</li>
<li>
<div class="content content2">2</div>
</li>
<li>
<div class="content content3">3</div>
</li>
<li>
<div class="content content4">4</div>
</li>
</ul>
</div>
jQuery demo
The demo should work fine in all recent versions of Firefox, Safari, and Chrome.
It looks like IE10 doesn't fully support the backface-visibility
property (with or without the -ms-
prefix). This prevents both the demo and the online example from working properly in IE10.
本文标签:
版权声明:本文标题:javascript - Card Flip effect using CSS3 rotateY but with multiple faces depending on button press? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742002991a2411392.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论