Vue realizes click flip effect

Vue realizes click flip effect

Use vue to simply implement a click flip effect for your reference. The specific content is as follows

1.

2.

3.

//html code test demo naming copied randomly <div class="Demo">
        <div class="Before" :class="isTop ? 'contain-Before' : ''" @click="handleBefore"></div>
        <div class="After" :class="isTop ? 'contain-After' : ''" @click="handleAfter" style="font-size:20px;color:black">This is the back content</div>
    </div>

//Define isTop:false in data

//Method handleBefore() in methods{
  if(!this.isTop){
         this.isTop = true
     }
 },
 handleAfter(){
     if(this.isTop){
         this.isTop = false
     }
 }
//css
.Demo{
    width: 375px;
    height: 300px;
    margin-top: 50px;
    /* margin-left: 500px; */
    position: relative;
    perspective: 800px;
    box-sizing: border-box;
    
    
}
.Before{
    width: 100px;
    height: 200px;
    position: absolute;
    top:0;
    left: 0;
    background-repeat: no-repeat;
    background-position: center center;
    backface-visibility: hidden;
    transition: 1.5s;
    background-image:url('../assets/images/chunfen4.jpg');
    border:1px solid yellow;
 
}
.After{
    width: 100px;
    height: 200px;
    position: absolute;
    top:0;
    left: 0;
    color: #fff;
    background-color:#fff;
    text-indent: 2em;
    transform: rotateY(-180deg);
    backface-visibility: hidden;
    transition: 1.5s;
    border:1px solid yellow;
}
.Demo .contain-Before{
    transform: rotateY(180deg);
}
.Demo .contain-After{
    transform: rotateY(0deg);
}

You are done. If you want to slide and flip, remove the event yourself and add the :hover method to div.

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:
  • Vue implements card flip carousel display
  • Vue.js realizes large-screen digital scrolling and flipping effects
  • Vue image browsing component v-viewer usage analysis [supports rotation, scaling, flipping and other operations]
  • Vue iview multiple pictures large picture preview, zoom and flip
  • Vue realizes the card flip effect

<<:  How to optimize MySQL deduplication operation to the extreme

>>:  Deploy Varnish cache proxy server based on Centos7

Recommend

Perfect solution for theme switching based on Css Variable (recommended)

When receiving this requirement, Baidu found many...

Example code for implementing equal width layout in multiple ways using CSS

The equal-width layout described in this article ...

A simple method to merge and remove duplicate MySQL tables

Scenario: The crawled data generates a data table...

Beginner's guide to building a website ⑥: Detailed usage of FlashFXP

Today I will introduce the most basic functions of...

Markup language - simplified tags

Click here to return to the 123WORDPRESS.COM HTML ...

Example verification MySQL | update field with the same value will record binlog

1. Introduction A few days ago, a development col...

SQL query for users who have logged in for at least n consecutive days

Take 3 consecutive days as an example, using the ...

Vue implements infinite loading waterfall flow

This article example shares the specific code of ...

CSS3 realizes the effect of triangle continuous enlargement

1. CSS3 triangle continues to zoom in special eff...

How to install Solr 8.6.2 in Docker and configure the Chinese word segmenter

1. Environment version Docker version 19.03.12 ce...

Tutorial on using the frameset tag in HTML

Frameset pages are somewhat different from ordina...

Detailed explanation of several methods of installing software in Linux

1. RPM package installation steps: 1. Find the co...

CSS realizes the layout method of fixed left and adaptive right

1. Floating layout 1. Let the fixed width div flo...