【发布时间】:2021-03-14 19:54:43
【问题描述】:
我有一个水平滚动的电影海报列表,当我将鼠标悬停在图像上时,图像会变大,但仅根据容器的高度可见。我希望图像在容器之外与其他元素重叠。我尝试在图像上使用“位置:绝对”,但列表中的其他图像没有按预期运行。
list.component.html
<div class="wrapper">
<h3>{{ heading }}</h3>
<div class="scrolls">
<div (click)="loadContent(content.id, content.type)" *ngFor="let content of list" class="imageDiv">
<img [src]="content.imgSrc" />
</div>
</div>
</div>
list.component.css
.wrapper {
background:transparent;
box-shadow: 1px 1px 10px #999;
margin: auto;
text-align: center;
position: relative;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
margin-bottom: 20px !important;
width: 100%;
padding-top: 5px;
}
h3 {
color: white;
font-weight: 500;
}
.scrolls {
overflow-x: scroll;
overflow-y: hidden;
white-space:nowrap;
height: 250px;
}
.imageDiv {
margin: 0;
height: 250px;
width: 1200px;
display: inline;
}
.imageDiv img {
box-shadow: 1px 1px 10px #999;
margin: 2px;
max-height: 250px;
cursor: pointer;
display: inline;
transition: all .2s ease-in-out;
}
img:hover {
-webkit-transform: scale(1.3);
-ms-transform: scale(1.3);
transform: scale(1.3);
z-index: 1 !important;
}
::-webkit-scrollbar{
height: 1px;
width: 1px;
background: gray;
}
::-webkit-scrollbar-thumb:horizontal{
background: #000;
border-radius: 10px;
}
图像列表
图像悬停
【问题讨论】:
标签: css angular hover css-transforms horizontal-scrolling