【发布时间】:2015-05-09 03:59:09
【问题描述】:
我研究了 CSS3 3d 变换,最后我得到了一些 CSS3 3d 翻转动作的代码。所以它在除 Internet Explorer (IE11) 之外的所有浏览器中都能正常工作。 所以我在stackoverflow.com上调查了这个问题。我得到了一些解决方案,但不幸的是这些对我没有用。因此,请查看我的 jsfiddle 链接并为此提供一些解决方案。
代码:
$('#one').click(function() {
if ($(this).is(':checked')) {
$("#card").addClass("flipped");
$(".back #append").append("<p>First one</p>")
}
});
$('#two').click(function() {
if ($(this).is(':checked')) {
$("#card").addClass("flipped");
$(".back #append").append("<p>second one</p>")
}
});
$('#three').click(function() {
if ($(this).is(':checked')) {
$("#card").addClass("flipped");
$(".back #append").append("<p>third one</p>")
}
});
$('#close').click(function() {
$("#card").removeClass("flipped");
});
.container {
width: 200px;
height: 260px;
position: relative;
-ms-perspective: 800px;
perspective: 800px;
}
#card {
width: 100%;
height: 100%;
position: absolute;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
transition: transform 1s;
}
#card figure {
display: block;
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
margin:0px;
padding:0px;
}
#card .front {
background: red;
}
#card .back {
background: blue;
-ms-transform: rotateY( 180deg );
transform: rotateY( 180deg );
}
#card.flipped {
-ms-transform: rotateY( 180deg );
transform: rotateY( 180deg );
}
#close{
position:absolute;bottom:0px;right:0px;color:#fff;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section class="container">
<div id="card">
<figure class="front">
<input type="checkbox" id="one"/>one<br></br>
<input type="checkbox" id="two"/>two<br></br>
<input type="checkbox" id="three"/>three<br></br>
</figure>
<figure class="back">
<div id="append"></div>
<div id="close"><button>close</button></div>
</figure>
</div>
</section>
更多详情见此链接:http://jsfiddle.net/Rayudu/jy0z8dy1/
请点击复选框然后翻转将发生并单击关闭按钮以删除翻转。
【问题讨论】:
-
这个答案是否有助于解决您的问题?如果是,请考虑通过单击空心刻度线将其标记为已接受。否则,请详细说明您面临的问题。
-
@Harry,抱歉迟到了。非常感谢。您的回答对我的查询非常有用。很好。
-
@Harry,我有一个疑问。之前我发布了一个关于堆栈溢出的问题。没有人为我提供好处。你能看看我的链接吗? "stackoverflow.com/questions/27655470/…"
-
该问题已被标记为重复配对。所以无法为那个添加任何答案:(
标签: jquery html css internet-explorer