我希望Flickity Slider Gallery有一个灯箱,并且某些文字会根据图像而动态变化

时间:2019-05-03 16:52:45

标签: javascript jquery flickity

我有一个Flickity滑块画廊,现在想以全屏方式打开我的图像,以供单击时使用。我不需要任何花哨的东西,甚至不需要关闭按钮,只需单击即可打开,然后单击即可关闭。

工作示例为this in the menu

然后,我还希望表的底部(也在示例链接中显示)可以动态更改。因此,当对Image1进行聚焦时,应该说标题:Project1,客户端:Client1。然后在Image2上:Title:Title2,Client:Client2。

这是我已经走了多远了: https://manuelauer.at/projects

<link rel="stylesheet" href="https://manuelauer.at/scripts/flickity.css">
<script src="https://manuelauer.at/scripts/flickity.pkgd.js"></script>

<div class="slideshow">
    <div class="carousel" data-flickity='{ "draggable": false, "pageDots": false, "wrapAround": true }'>
     <div class="carousel-cell"><div class="content"><div class="image"><img src="http://manuelauer.at/wp-content/uploads/2019/02/01_frame.jpg"></div><div class="number"><span>01</span></div></div></div>
     <div class="carousel-cell"><div class="content"><div class="image"><img src="http://manuelauer.at/wp-content/uploads/2019/02/01_frame.jpg"></div><div class="number"><span>02</span></div></div></div>
     <div class="carousel-cell"><div class="content"><div class="image"><img src="http://manuelauer.at/wp-content/uploads/2019/02/01_frame.jpg"></div><div class="number"><span>03</span></div></div></div>
     <div class="carousel-cell"><div class="content"><div class="image"><img src="http://manuelauer.at/wp-content/uploads/2019/02/01_frame.jpg"></div><div class="number"><span>04</span></div></div></div>
     <div class="carousel-cell"><div class="content"><div class="image"><img src="http://manuelauer.at/wp-content/uploads/2019/02/01_frame.jpg"></div><div class="number"><span>05</span></div></div></div>
     <div class="carousel-cell"><div class="content"><div class="image"><img src="http://manuelauer.at/wp-content/uploads/2019/02/01_frame.jpg"></div><div class="number"><span>06</span></div></div></div>
     <div class="carousel-cell"><div class="content"><div class="image"><img src="http://manuelauer.at/wp-content/uploads/2019/02/01_frame.jpg"></div><div class="number"><span>07</span></div></div></div>
    </div>

    <div class="credit">
      <p class="label">Title</p>
      <p class="text">Title1</p>
      <p class="label">Client</p>
      <p class="text">Client1</p>
    </div>
</div>
.flickity-button {
  background: black !important;
}

.flickity-prev-next-button {
  width: 40px;
  height: 40px;
  border-radius: 0 !important;
}

.flickity-prev-next-button .arrow  {
  fill: white !important;
}

.flickity-prev-next-button.previous {
  left: -40px;
}
.flickity-prev-next-button.next {
  right: -40px;
}

.flickity-prev-next-button .flickity-button-icon {
left: 20%;
top: 20%;
width: 60%;
height: 60%;
}

.carousel-cell {
  width: 35%;
  padding-bottom: 10px;
  margin-right: 10px;
  counter-increment: carousel-cell;
}

.image {
  margin: 0;
  padding: 0;
  height: 100%;
}

.number {
  color: #aaaaaa;
  font-family: 'gt_america_monoregular';
  font-size: 12px;
  padding-top: 10px;
}

.number span {
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 50%;
  transition: .5s;
}

.content:hover .number span {
  border: 1px solid #fab315;
  border-radius: 50%;
  transition: .5s;
  color: #fab315;
}

.content:hover {
  cursor: zoom-in;
}

.slideshow {
  align-items: center;
  display: flex;
  height: 100vh;
  justify-content: center;
  position: relative;
}

.title {
  font-family: 'gt_america_monoregular';
  font-size: 12px;
  color: white;
  top: 30px;
  position: absolute;
  text-align: center;
}

.carousel {
  position: relative;
  width: 100%;
  z-index: 1;
  height: 270px;
}

.credit {
  bottom: 5%;
  position: absolute;
  width: 320px;
  border-bottom: 1px solid white;
  border-left: 1px solid white;
  display: grid;
  grid-template-columns: auto 1fr;
  font-family: 'gt_america_monoregular';
  color: white;
}

.credit .label {
  text-transform: uppercase;
  margin: 0;
  font-size: 10px;
  padding: 11px .5rem;
}

.credit p {
  border-top: 1px solid;
  border-right: 1px solid;
}

.credit .text {
   padding: 0.5rem !important;
   margin: 0;
   font-size: 12px;
}

p {
  margin: 0;
  display: block;
  margin-block-start: 1em;
  margin-block-end: 1em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
}

@media screen and ( min-width: 300px ) {
  .carousel-cell {width: 75%; margin: auto;}
  .flickity-prev-next-button {top: 30% !important;}
  .title {display: block; top: 15%;}
  .credit {bottom: 15%;}
}

@media screen and ( min-width: 522px ) {
  .carousel-cell {width: 35%; margin: 0;  margin-right: 10px;}
  .flickity-prev-next-button {top: 50% !important;}
  .title {display: none;}
  .credit {bottom: 5%;}
}

0 个答案:

没有答案