JSFiddle - React, Tailwind, and code Playground
by Young11
HTML
<div id="app" :class="{play:play}">
<div :class="['Window-1 window', {active:active, prepare:prepare}]" @click="onSelect(1)" @play="onPlay" :spawn="true">
<div class="wrap">
<div class="title">Появиться на точке<br> последнего выхода</div>
<div class="hr"></div>
<div class="title title-2">Вы не потеряете ничего</div>
</div>
<div class="loading-screen">
<div class="logo"> </div>
<div class="text">Загрузка...</div>
</div>
</div>
<div :class="['Window-2 window', {gray:!spawns.window2, active:active, prepare:prepare}]" @click="onSelect(2)" @play="onPlay" :spawn="true">
<div v-if="spawns.window2" class="wrap">
<div class="title">Появиться в своём доме</div>
<div class="hr"> </div>
<div class="title title-2">Содержимое инвентаря будет сброшено (кроме одежды)</div>
</div>
<div v-else class="wrap-lock">
<div class="icon"> </div>
<div class="title">Для разблокировки возможности появления<br> в доме необходимо его купить</div>
</div>
<div class="loading-screen">
<div class="logo"> </div>
<div class="text">Загрузка...</div>
</div>
</div>
<div :class="['Window-3 window', {gray:!spawns.window3, active:active, prepare:prepare}]" @click="onSelect(3)">
<div v-if="spawns.window3" class="wrap" @play="onPlay" :spawn="true">
<div class="title">Появиться на территории фракции</div>
<div class="hr"></div>
<div class="title title-2">Содержимое инвентаря будет сброшено (кроме одежды)</div>
</div>
<div v-else="" class="wrap-lock">
<div class="icon"> </div>
<div class="title">Для разблокировки возможности появления<br> в фракции необходимо в неё вступить</div>
</div>
<div class="loading-screen">
<div class="logo"> </div>
...
CSS
.Window-1 {
height: 100vh;
top: 0;
bottom: 0;
left: 0;
z-index: 0;
}
.Window-1:before {
background: url("/img/window-1-bg.png") no-repeat center center;
background-size: cover;
}
.Window-1:not(.active):hover:after {
background: rgba(0, 44, 202, 0.2);
}
.Window-2 {
height: 50vh;
top: 0;
right: 0;
z-index: 1;
}
.Window-2:before {
background: url("/img/window-2-bg.png") no-repeat center center;
background-size: cover;
}
.Window-2:not(.active):not(.gray):hover:after {
background: rgba(174, 0, 31, 0.2);
}
.Window-3 {
height: 50vh;
bottom: 0;
right: 0;
z-index: 2;
}
.Window-3:before {
background: url("/img/window-3-bg.png") no-repeat center center;
background-size: cover;
}
.Window-3:not(.active):not(.gray):hover:after {
background: rgba(177, 128, 0, 0.2);
}
.window {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 50%;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
overflow: hidden;
position: fixed;
-webkit-transition: width .3s, height .3s;
transition: width .3s, height .3s;
}
.window.active {
width: 100%;
height: 100vh !important;
z-index: 3 !important;
}
.window:before, .window:after {
content: "";
display: block;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 0;
}
.window:before {
-webkit-transform: scale(1.1);
transform: scale(1.1);
-webkit-transition: -webkit-transform .3s;
transition: -webkit-transform .3s;
transition: transform .3s;
transition: transform .3s, -webkit-transform .3s;
}
.window.gray:before {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
.window:not(.active):not(.gray):hover:before {
-webkit-transform:...
Vue
new Vue({
el: '#app',
props: {
spawn: Boolean
},
name: 'App',
data() {
return {
play: false,
active: false,
prepare: false,
spawns: {
window2: false,
window3: true
}
}
},
methods: {
onPlay(windowID) {
this.play = true
console.log(windowID)
},
onSelect(windowID) {
if (this.spawn !== true)
return false
this.active = true
setTimeout(() => this.prepare = true, 6000)
setTimeout(() => this.$emit("play", windowID), 8000)
}
}
});