
<template>
<div id="all-box">
<div v-for="(item,index) in dataLists" :class="['c-item-'+index,currsorIndex==index?'c-item-hover':'']"
@mouseover="mouseOver(index)" :key="index">
<div v-show="currsorIndex!=index" class="title-box">{{item.title}}</div>
<div class="currsor-content-box">
<div class="currsor-title-box">{{item.title}}</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
currsorIndex: 0,
dataLists:[
{title:'标题一'},
{title:'标题二'},
{title:'标题三'},
{title:'标题四'},
],
```},
methods: {
mouseOver(index) {
//鼠标移入设置不同样式
this.currsorIndex = index
},
}
</script>
#all-box{
width: 100%;
height: 352px;
margin-top: 20px;
display: flex;
display: -ms-flex;
flex-direction: row;
justify-content: space-between;
}
.c-item-0,
.c-item-1,
.c-item-2,
.c-item-3 {
position: relative;
height: 352px;
width: 160px;
border-radius: 2px;
transition: width 0.4s;
transition-timing-function: ease;
background: #2f56a7;
border-radius: 4px;
overflow: hidden;
position: relative;
transition: all 0.5s;
transition-timing-function: ease;
}
.c-item-3 {
margin-right: 0px;
}
.c-item-hover {
width: 700px;
height: 352px;
background: linear-gradient(280.39deg, #85b5f4 5.53%, #3a73ed 84.52%);
transition: all 0.5s;
transition-timing-function: ease;
.img-right-bg {
opacity: 1;
transition: all 0.5s linear;
}
.currsor-content-box{
transition: all 0.5s linear;
opacity: 1;
}
}
.currsor-content-box {
width: 100%;
margin-top: 109px;
padding-left: 40px;
position: absolute;
z-index: 1;
opacity: 0;
.currsor-title-box {
color: #fff;
font-size: 22px;
}
}
版权声明:本文为weixin_48736143原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。