Codeinwp / Ideal-Image-Slider-JS

Quite simply the ideal Image Slider in vanilla JS.
http://idealimageslider.com
GNU General Public License v3.0
1.57k stars 160 forks source link

How can I set the height of the div slider to be the same as the content? #47

Closed antonioj1015 closed 9 years ago

antonioj1015 commented 9 years ago

I'm using bootstrap on my site and I need the height of the div slider to be the same as the content. How can I do this?

I did this so the image is shown but the height of the div slider is always the same.

slider a {

background-size: contain;

}

If I apply <div id="slider" style="overflow: hidden;"> it wont work either.

7yl4r commented 9 years ago

I suggest passing the height in the options when you init your slider in js.

Assuming your html structure is similar to:

<div id="content-section">
  <div id="slider">
     ...slider content here...
  </div>
</div>

Do something like this:

var slider = new IdealImageSlider.Slider({
    selector: '#slider',
    height: $('#content-section').height()
});
slider.start();