I am trying to teach myself about swipe functions as in this day and age they are becoming more and more useful. I have a css animation below of a spinnning div. At the moment it just spins on hover but what I want to achieve is a spin on swipe/touch.
MY CSS ANIMATION
.trigger {
width: 100%;
height: 400px;
background-color: white;
}
.hover-img {
position: relative;
width: 200px;
height: 200px;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
-webkit-transform-style: preserve-3d;
text-align: center;
font-size: 0;
}
.trigger:hover>.hover-img {
-webkit-transform: rotateY(360deg);
-moz-transform: rotateY(360deg);
-ms-transform: rotateY(360deg);
-o-transform: rotateY(360deg);
transform: rotateY(360deg);
font-size: 14px;
color: white;
}
MY HTML
<div id="cell1">
<div class="trigger">
<div tabindex="0" class="maincontentdiv4 hover-img" style="box-shadow: 5px 5px 5px #999; height: 390px; background-image: url(slide2.png);">ffffffffffff
</div>
</div>
<br><br><br><br>
<div class="trigger">
<div tabindex="0" class="maincontentdiv4 hover-img" style="box-shadow: 5px 5px 5px #999; height: 390px; background-image: url(slide2.png);">ffffffffffff
</div>
</div>
</div>
This is a JS Fiddle showing what I currently have.
This is a livelink of where I am using this animation, I shall delete this as soon as the question is answered for future posterity of this post.
UPDATED CSS FOR L.H
.trigger {
width: 100%;
height: 400px;
background-color: white;
}
.hover-img:active {
background-color: green;
position: relative;
width: 200px;
height: 200px;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
-webkit-transform-style: preserve-3d;
text-align: center;
font-size: 0;
}
.trigger:hover>.hover-img:active {
-webkit-transform: rotateY(360deg);
-moz-transform: rotateY(360deg);
-ms-transform: rotateY(360deg);
-o-transform: rotateY(360deg);
transform: rotateY(360deg);
font-size: 14px;
color: white;
}
UPDATED HTML
<body ontouchstart="">
<div id="cell1">
<div class="trigger">
<div tabindex="0" class="maincontentdiv4 hover-img" style="box-shadow: 5px 5px 5px #999; height: 390px; background-image: url(slide2.png);">ffffffffffff
</div>
</div>
<br><br><br><br>
<div class="trigger">
<div tabindex="0" class="maincontentdiv4 hover-img" style="box-shadow: 5px 5px 5px #999; height: 390px; background-image: url(slide2.png);">ffffffffffff
</div>
</div>
</div>