简体   繁体   English

如何在模态框中实现滑块?

[英]How to implement slider in modal box?

I am trying to implement slider inside the modal box but this is not working.我正在尝试在模态框内实现滑块,但这不起作用。 I am using modal box and trying to implement slider inside the modal box.我正在使用模态框并尝试在模态框内实现滑块。

Here is my code:这是我的代码:

$("#lightSlider").lightSlider({ 
    auto:false,     
    adaptiveHeight: false,      
});

Slider is coming only then I do inspect from browser and modal box keeps changing its size during inspect element.滑块只有在我从浏览器进行检查时才会出现,并且模式框在检查元素期间不断改变其大小。

Any idea why this is happening or do I need to change my slider?知道为什么会发生这种情况还是我需要更改滑块?

Just use a carousal slider inside your modal body只需在模态主体内使用旋转滑块

<div id="myCarousel" class="carousel slide" data-ride="carousel">
 <ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol><div class="carousel-inner" role="listbox">
<div class="item active">
  <img src="img_chania.jpg" alt="Chania">
</div>

<div class="item">
  <img src="img_chania2.jpg" alt="Chania">
</div>

<div class="item">
  <img src="img_flower.jpg" alt="Flower">
</div>

<div class="item">
  <img src="img_flower2.jpg" alt="Flower">
</div>

<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>

<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
  </a>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM