Reputation: 36267
I am putting together a slide presentation using a jquery plugin called 'slick' (http://kenwheeler.github.io/slick/) using django and a bootstrap 3 template. I've got a basic carousel working using a django template that looks like:
{% load staticfiles %}
<div class="your-class">
<div>your content</div>
<div><IMG src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSj2c33fdt1ugB8VBuE5V37wnmPoxWMknX9JnGycNiH2yr3BpDKVA"></div>
<div><IMG src="{% static 'img/slides/slide1.jpg' %}"></div>
<div>your content</div>
</div>
After adding the last slide I notice that the forward backward buttons were pushed way down (please see screenshot). I'm guessing this is related to the size of the slide. I just added.
I'm not a front end person so this is probably a basic question, but what is the best way to have a consistent size of slides. Can they be autoscaled to fit a predetermined size if they are different in original size. I'm making some of these by hand as well so I could in theory I could set them to a specific size if that would help
Upvotes: 0
Views: 1036
Reputation: 3401
You can set width and height of any image via CSS. If you set only width or only height, it will scale the other dimension to keep the width/height ratio.
In css, you can do something like this:
#slider img {
width: 600px;
}
Upvotes: 1
Reputation: 992
You can also set the css height property to a fixed amount, i.e.,
<div class="img-wrap"><img src="..."/></div>
div.img-wrap {
overflow:hidden;
height:100px;
}
div.img-wrap img {
width:auto;
height: 100px;
}
If you really want to do it programmatically, you can use a JQuery plugin like Image Resize
Upvotes: 1
Reputation: 450
Try adding the property width
in the img
selector:
<div><img width="100%" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSj2c33fdt1ugB8VBuE5V37wnmPoxWMknX9JnGycNiH2yr3BpDKVA"></div>
DEMO: http://jsfiddle.net/ws4ty6wo/
Upvotes: 1