Wednesday, May 25, 2016

Flip an image on mouse hover ADF


CSS:


 /*entire container, keeps perspective */
.flip-container {
perspective: 1000px;
}
/* flip the pane when hovered */
.flip-container:hover .flipper, .flip-container.hover .flipper {
transform: rotateY(180deg);
}

.flip-container, .front, .back {
width: 320px;
height: 480px;
}

/* flip speed goes here */
.flipper {
transition: 0.6s;
transform-style: preserve-3d;

position: relative;
}

/* hide back of pane during swap */
.front, .back {
backface-visibility: hidden;

position: absolute;
top: 0;
left: 0;
}

/* front pane, placed above back */
.front {
z-index: 2;
/* for firefox 31 */
transform: rotateY(0deg);
}

/* back, initially hidden pane */
.back {
transform: rotateY(180deg);
}

jspx page:




  <af:panelGroupLayout id="pgl3">

        <div id="card" class="flip-container" ontouchstart="this.classList.toggle('hover');"> 
  <div class="flipper"> 
   <div class="front"> 
    Front content
     <af:image source="/images/saved-complete.png" id="id2"/>
  </div> 
  <div class="back">
    Back content
     <af:image source="/images/saved-img.jpg" id="id1"/>
  </div> 
  </div> 
</div>
  
        </af:panelGroupLayout>



 https://davidwalsh.name/css-flip

No comments: