gpt4 book ai didi

jquery - Flickity: is-selected 类无法查看图片

转载 作者:行者123 更新时间:2023-11-28 15:40:39 25 4
gpt4 key购买 nike

昨天我有一个用户不友好的轮播。然后我搜索其他灵活且响应迅速的旋转木马解决方案,然后谢天​​谢地我得到了这个 Flickity's carousels a fun to flick by David DeSandro。现在,我在添加图像时遇到了问题。我看不到任何图片。原始文件位于此处 http://codepen.io/desandro/pen/gbjzre .我的代码如下。

<!DOCTYPE html>
<html>

<head>
<title>Flickity</title>
<!--Flickity-->
<link rel="stylesheet" href="https://unpkg.com/flickity@2/dist/flickity.min.css">
<script src="https://unpkg.com/flickity@2/dist/flickity.pkgd.min.js"></script>
</head>

<body>
<div class="gallery js-flickity" data-flickity='{ "autoPlay": true }'>
<div class="gallery-cell"> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/orange-tree.jpg" alt="orange tree" /></div>
<div class="gallery-cell"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/submerged.jpg" alt="submerged" /></div>
<div class="gallery-cell"> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/one-world-trade.jpg" alt="One World Trade" /></div>
<div class="gallery-cell"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/drizzle.jpg" alt="drizzle" /></div>
<div class="gallery-cell"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/cat-nose.jpg" alt="cat nose" /></div>
<div class="gallery-cell"> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/contrail.jpg" alt="contrail" /></div>
<div class="gallery-cell"> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/golden-hour.jpg" alt="golden hour" /></div>
</div>
</body>

</html>
<style type="text/css">
/* external css: flickity.css */

* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}

body {
font-family: sans-serif;
}

.gallery-cell {
width: 28%;
height: 200px;
margin-right: 10px;
background: #8C8;
counter-increment: gallery-cell;
}

.gallery-cell.is-selected {
background: #ED2;
}

/* cell number */

.gallery-cell:before {
display: block;
text-align: center;
content: counter(gallery-cell);
line-height: 200px;
font-size: 80px;
color: white;
}
</style>
<script type="text/javascript">
// external js: flickity.pkgd.js
</script>

最佳答案

感谢 @Ricky 提供以下解决方案,这里是您提供给我的以下解决方案。

第一种方式。我只是删除了 <div class="gallery-cell">相反,我只是添加 class="gallery-cell"里面img元素。

<img class="gallery-cell" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/contrail.jpg" alt="contrail" />

第二个解决方案,我只是在 .gallery-cell:before 中添加代码

.gallery-cell:before {
display: block;
text-align: center;
/* content: counter(gallery-cell);*/
line-height: 200px;
font-size: 80px;
color: white;

/*@Ricky 2nd Solution*/
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

关于jquery - Flickity: is-selected 类无法查看图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43509617/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com