This article example shares the specific code of Vue to achieve the card flip effect for your reference. The specific content is as follows 1. Achieve resultsAchieve a flip effect along the center Y axis by clicking. 2. MethodsIt is divided into two parts, the front and the back. The div behind is set through the CSS layout to be flipped 180 degrees and hidden behind the div in the front. Click to execute the flip animation. When executing the flip animation, set the div behind to be displayed, and then hide the div in the front. Repeat in sequence. 3. Specific code<template> <div id="try"> <!-- Perform front flip animation under box_rolling--> <div class="rollbox" :class="{'box_rolling':isRolling}" @click="isRolling = !isRolling"> <!-- front div --> <div class="rollbox_front"> <div class="contentbox"> <img src="@/assets/images/s1.png"/> </div> </div> <!-- next div --> <div class="rollbox_behind"> <div class="contentbox"> <img src="@/assets/images/s2.png"/> </div> </div> </div> </div> </template> <script> export default{ name:'try', data(){ return { isRolling:false } } } </script> <style lang='scss'> #try{ .rollbox{ position: relative; perspective: 1000px; width:200px; height: 400px; margin:100px auto; &_front, &_behind{ transform-style: preserve-3d; //Indicates that all child elements are presented in 3D space backface-visibility: hidden; //Whether the element is visible when the back is facing the screen transition-duration: .5s; transition-timing-function:'ease-in'; background:#008080; .contentbox{ width:200px; height: 400px; display: flex; justify-content: center; align-items: center; >img{ width:100px; } } } &_behind{ transform: rotateY(180deg); visibility:hidden; //The element is invisible, but occupies space position: absolute; top:0; bottom:0; right: 0; left: 0; } } .box_rolling{ .rollbox_front{ transform: rotateY(180deg); visibility:hidden; } .rollbox_behind{ transform: rotateY(360deg); visibility:visible; } } } </style> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Deploy Varnish cache proxy server based on Centos7
>>: How to create a database in navicat 8 for mysql
In a complex table structure, some cells span mul...
1. Install Docker. Reference URL: Docker Getting ...
This article mainly introduces the analysis of My...
1. Introduction The EXPLAIN statement provides in...
float:left/right/none; 1. Same level floating (1)...
Link: https://qydev.weixin.qq.com/wiki/index.php?...
Table of contents I. Overview 2. Conventional mul...
1. When inserting, updating, or removing DOM elem...
First: via text/HTML var txt1="<h1>Tex...
1. Create a configuration file directory cd /home...
After VMware is abnormally shut down, it prompts ...
1. Technical points involved vite version vue3 ts...
XML/HTML CodeCopy content to clipboard < div c...
Without further ado, I will post the code for you...
Table of contents 1. Concept Memory management mo...