I am trying to implement a CSS flip effect that activates on a button click. However, when I place it within an asp.net form, the flip doesn't work. I suspect that the asp.net form may be auto-refreshing and causing issues. Any assistance would be greatly appreciated.
*/The Css /*
.flip-container {
perspective: 1000px;
}
.flip-container.hover .flipper, .flip-container.hover .flipper {
transform: rotateY(180deg);
}
.flip-container, .front, .back {
width: 320px;
height: 480px;
}
.flipper {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
.front, .back {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
.front {
z-index: 2;
/* for firefox 31 */
transform: rotateY(0deg);
}
.back {
transform: rotateY(180deg);
}
The code works in the format shown below:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="NewUser.test" %>
<link rel="stylesheet" href="\_Layout\_Flip.css">
<link rel="stylesheet" href="\_Layout\_Layout.css">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
</form>
<div class="flip-container" id="FLIPDIV">
<div class="flipper">
<div class="front">
Front
<button onclick="Flip()">Flip Me!</button>
</div>
<div class="back">
Back
</div>
</div>
</div>
</body>
</html>
<script>
function Flip() {
var x = document.getElementById('FLIPDIV');
x.classList.toggle('hover');
}
</script>
However, when I try to incorporate it into an ASP.NET Form, the flip stops working. I need the form for ASP:textboxes, so any guidance on resolving this issue would be highly appreciated.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="NewUser.test" %>
<link rel="stylesheet" href="\_Layout\_Flip.css">
<link rel="stylesheet" href="\_Layout\_Layout.css">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div class="flip-container" id="FLIPDIV">
<div class="flipper">
<div class="front">
Front
<button onclick="Flip()">Flip Me!</button>
</div>
<div class="back">
Back
</div>
</div>
</div>
</form>
</body>
</html>
<script>
function Flip() {
var x = document.getElementById('FLIPDIV');
x.classList.toggle('hover');
}
</script>
I suspect the form may be causing some kind of refresh on button presses, but I'm not certain. Any help from experts in this area would be incredibly helpful :)