【问题标题】:Is there any possibility to show element over owl carousel item?是否有可能在猫头鹰轮播项目上显示元素?
【发布时间】:2021-01-12 14:59:10
【问题描述】:

我创建了两个并排的猫头鹰轮播滚动元素。架构:

我想实现,价格项目描述略高于猫头鹰轮播项目边界。架构: 有人可以使用 css 或 jquery 帮助解决这种情况吗?

编辑: 我制作了复制品。有两个猫头鹰元素。我想要 price:before 元素可见:

$("#banner_section_right .slider").owlCarousel({});
$("#banner_section_left .slider").owlCarousel({});
#container {
  width: 100%;
  height: 200px;
  background: blue;
  position: relative;
  float: left;
}
#banner_section_right {
  width: 70%;
  background: red;
  float: left;
}
#banner_section_left {
  width: 30%;
  background: green;
  float: left;
}
#banner_section_left .item {
  width: 100%;
  background: yellow;
}
#banner_section_left .item:before {
    width: 1em;
    background: yellow;
    top: 0;
    content: "";
    position: absolute;
    right: 100%;
 
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.transitions.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.theme.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css" rel="stylesheet"/>
<div id="container">
  <div id="banner_section_right">
    <div class="slider">
      <div class="item">
        <p>
        Viens
        </p>
      </div>
       <div class="item">
        <p>
        Divi
        </p>
      </div>
      <div class="item">
        <p>
        Viens
        </p>
      </div>
       <div class="item">
        <p>
        Divi
        </p>
      </div>
    </div>
  </div>  
  <div id="banner_section_left">
    <div class="slider">
      <div class="item">
        <p>
        $1 000 000
        </p>
      </div>
    </div>
  </div>  
</div>

【问题讨论】:

  • 你需要分享so代码
  • 添加代码和演示

标签: css carousel owl-carousel


【解决方案1】:

我有一个例子,你可以从中学习可能会帮助你实现你想要实现的目标。

html:

<div id="container">

  <div class="green"></div>
  <div class="red"></div>
  <div class="box"></div>

</div>

CSS:

#container{
  width: 100%;
  height: 200px;
  background: blue;
  position: relative;
}
div.green{
  background: green;
  display: block;
  height: 100px;    
}
div.red{
  background: red;
  display: inlinblock;
  height: 100px;
}
div.box{
  width: 100px;
  height: 100px;
  background: yellow;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

看看这个 css 属性 transform: translateY(-50%); 这可以将对象移到其他对象之上。

工作示例:http://fiddlesalad.com/css/div-over-other-div

【讨论】:

  • 您能否查看我的演示并回答为什么没有显示元素之前的课程价格?
  • @Developer 我在这个小提琴中更新了我的代码。我希望我能接近你想要实现的目标。 fiddlesalad.com/css/div-transform-translate
  • 感谢您的宝贵时间。但我想实现第二个滑块每个项目元素。你能做到吗?
猜你喜欢
  • 2014-10-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多