如何使用jQuery对父div中的子div进行计数并显示每个子div中的订单号?

ylamdve6  于 2022-10-09  发布在  jQuery
关注(0)|答案(0)|浏览(111)

我目前正在Webflow中建立一个CMS图库列表,我想在每个单独的子div中自动显示一个数字。

我可以看到,我可能需要实现某种jQuery代码,我正在努力重写现有的解决方案。

在下面的代码中,我想要计算.Feature-Slider_List中的子项数量,然后显示.Feature-Slider_Number中的子订单号。

任何帮助都将不胜感激!

.feature-slider_item {
    width: 200px;
    height: 200px;
    margin-bottom: 50px;
    background-color: black;
}

.feature-slider_wrap {
    position: relative;
}

.feature-slider_number {
    position: absolute;
    left: 30px;
    top: auto;
    right: auto;
    bottom: 30px;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    width: 70px;
    height: 70px;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    border-radius: 10px;
    background-color: #00d6d6;
    -webkit-transform: rotate(-6deg);
    -ms-transform: rotate(-6deg);
    transform: rotate(-6deg);
    color: #fff;
    font-size: 2rem;
    line-height: 2.5rem;
    font-weight: 700;
}
<div class="feature-slider_list">
  <div class="feature-slider_item">
    <div class="feature-slider_wrap">
      <img src="" class="feature-slider_image">
      <div class="feature-slider_number">1</div>
    </div>
  </div>
  <div class="feature-slider_item">
    <div class="feature-slider_wrap">
      <img src="" class="feature-slider_image">
      <div class="feature-slider_number">1</div>
    </div>
  </div>
  <div class="feature-slider_item">
    <div class="feature-slider_wrap">
      <img src="" class="feature-slider_image">
      <div class="feature-slider_number">1</div>
    </div>
  </div>
  <div class="feature-slider_item">
    <div class="feature-slider_wrap">
      <img src="" class="feature-slider_image">
      <div class="feature-slider_number">1</div>
    </div>
  </div>
</div>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题