我有一排缩略图,其中一个动画标题以显示为:flex。当单击缩略图按钮时,将出现幻灯片的模态。模态关闭后,选定画廊的缩略图不合适。我对此进行了广泛的CSS调试,但没有找到任何结论性。我认为它是引导模态JS的副作用或与显示有关的事情:flex-显示:悬停在悬停的块开关。
.gallery-top {
height: 220px;
margin-bottom: 10px;
.swiper-slide {
width: 100%;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
position: relative;
z-index: 1;
border-right: 3px solid #fff;
}
}
.gallery-row {
padding: 0 0 0 2px;
}
.gallery-thumbs {
height: 90px;
.swiper-slide {
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
position: relative;
z-index: 1;
border-right: 3px solid #fff;
}
}
.galleryThumbs {
div.galleryThumbWrapper {
padding-right: 2px;
padding-bottom: 2px;
>div {
width: 100%;
height: 100%;
}
}
.cta_box {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
text-align: center;
color: white;
background: rgba(138, 196, 64, 0.6);
z-index: 2;
.cta_holder {
padding-bottom: 20px;
.title {
font-size: 1.2em;
line-height: 1em;
padding: 20px 20px 10px 20px;
font-family: proxima-nova;
font-weight: 600;
color: white;
text-transform: uppercase;
margin: 20px 0 0 0;
}
.button {
cursor: pointer;
color: white;
background: transparent;
border: 1px solid #fff;
border-radius: 30px;
display: inline-block;
padding: 3px 16px;
font-family: proxima-nova;
font-weight: 600;
font-size: 1em;
text-transform: uppercase;
}
}
}
&:last-child {
border: 0;
}
}
@media screen and (min-width: 768px) {
.gallery-top {
height: 320px;
}
}
@media screen and (min-width: 1024px) {
.col-lg-5ths {
width: 20%;
flex: 0 0 20%;
}
.gallery-top {
height: 420px;
}
.galleryThumbs {
.cta_box {
display: block;
justify-content: center;
align-items: center;
top: 100%;
transition: top 0.75s;
}
&:hover .cta_box {
top: 0;
display: block;
.cta_holder {
display: block;
}
}
}
}
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
<div class="row gallery-row">
<div class="col-12 col-md-6 col-lg-5ths galleryThumbs embed-responsive embed-responsive-1by1">
<div class="embed-responsive-item galleryThumbWrapper">
<div style="background: url('http://lorempixel.com/400/400/') no-repeat center center; background-size: cover;">
<div class="cta_box">
<div class="cta-content">
<div class="cta_holder">
<p class="title">Headline 1</p>
<div>
<button type="button" class="button" data-toggle="modal" data-target="#galleryModal" data-gallery="{{gall.uri}}">View Project</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="galleryModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<p>
My Modal
</p>
</div>
</div>
</div>
这是小提琴。
https://jsfiddle.net/sdetcp51/
这是因为在@media screen and (min-width: 1024px)
上,您将.cta_box
的顶部设置为100%,这将盒子推到底部,但是您仍然将其底部设置为"从上一样式"中的0。这基本上使盒子0高。因此,它的内容将溢出。
模态关闭后背景图像的移动是由于框内容溢出。
修复很容易。只需在.cta_box
上添加overflow: hidden;
。
小提琴:https://jsfiddle.net/sdetcp51/54/