Vue
by Serhii Matrunchyk
HTML
<div id="app">
<div class="wrapper">
<div class="first">
<transition name="fade">
<div v-if="!buy" class="circle">
</div>
</transition>
<transition name="fade">
<div v-if="buy" class="ticket">
</div>
</transition>
<div class="tickets">
<div @click="buy = 0">
Ticket 1
</div>
<div @click="buy = 1">
Ticket 2
</div>
<div>
Ticket 3
</div>
<div>
Ticket 4
</div>
</div>
</div>
<div class="middle">
<div>1999</div>
<transition name="fade">
<div v-if="buy">
<button>BUY</button>
</div>
</transition>
</div>
<div>
MAN
</div>
</div>
</div>
CSS
body, html {
background: #20262E;
padding: 0;
margin: 0;
font-family: Helvetica;
}
#app {
background: #fff;
height: 100vh;
padding: 50px;
}
.fade-enter-active, .fade-leave-active {
transition: all .5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
opacity: 0;
transform: scale(5);
}
.circle {
width: 430px;
height: 430px;
border-radius: 500px;
background: magenta;
position: absolute;
z-index: 1;
}
.tickets {
display: grid;
grid-template-columns: repeat(4, 100px);
height: 350px;
grid-gap: 10px;
transform: translate3d(0, 200px, 0);
z-index: 0;
}
.tickets > div {
cursor: pointer;
}
.tickets > div:nth-child(1) {
background: red;
}
.tickets > div:nth-child(2) {
background: green;
}
.tickets > div:nth-child(3) {
background: blue;
}
.tickets > div:nth-child(4) {
background: yellow;
}
.wrapper {
display: grid;
grid-template-columns: 500px 200px 300px;
}
.middle {
display: flex;
align-items: center;
}
.middle > div {
margin: 10px;
}
.ticket {
width: 500px;
height: 100px;
background: black;
position: absolute;
z-index: 1;
transform: translate3d(-30px, 450px, 0);
}
Vue
new Vue({
el: "#app",
data: {
buy: false,
},
methods: {
toggle: function(todo){
todo.done = !todo.done
}
}
})