我有一个简单的卡片,当我将鼠标悬停在上面时,它会放大。但在移动设备上,悬停、聚焦或激活功能无效。
在移动设备上,我希望当有人点击这张卡片时,它能够实现悬停、聚焦或激活的效果。
是否有任何选项可以实现这一点?
.card {
transition: transform .2s;
background-repeat: no-repeat;
max-width: 25%;
min-width: 25%;
height: 200px;
margin: 50px;
background: lightblue;
}
.hover-content {
display: none;
width: 80%;
height: 50%;
margin: 0 auto;
}
.content {
background: red;
}
.card:hover, .card:focus, .card:active {
position: relative;
z-index: 2;
opacity: 1;
transform: scale(1.2);
}
.card:hover .hover-content, .card:focus .hover-content, .card:active .hover-content {
margin-top: 20px;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
<div class="card">
<div class="content">
<p>iasJ ASJKAS AISJ</p>
</div>
<div class="hover-content">
<p>aksainsi qjsn asj iqjsi asijqs </p>
</div>
</div>