I'm using the Jssor library to create an image slider. I set $FillMode to 4 so that the images should fit in the container, but it didn't work. This is what one of the images looks like:
So I tried every other mode and didn't see any changes.
Here is my code:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jssor.core.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jssor.utils.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jssor.slider.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jssor.slider.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jssor.slider.mini.js"></script>
</head>
<body>
<div id="main">
<h1>Swipe right for yes and left for no.</h1>
<div id="slider1_container" style="position: relative; top: 0px; left: 0px; width: 300px; height: 600px; overflow: hidden;">
<!-- Slides Container -->
<div u="slides" style="cursor: move; position: absolute; overflow: hidden; left: 0px; top: 0px; width: 300px; height: 600px;">
<div><img src="{{ STATIC_URL }}images/indian.jpg" alt="" title=""/></div>
<div><img src="{{ STATIC_URL }}images/hamburger.jpg" alt="" title=""/></div>
<div><img src="{{ STATIC_URL }}images/italian-pizza.jpg" alt="" title=""/></div>
<div><img src="{{ STATIC_URL }}images/hummus.jpg" alt="" title=""/></div>
<div><img src="{{ STATIC_URL }}images/pie.jpg" alt="" title=""/></div>
<div><img src="{{ STATIC_URL }}images/montecristo.jpg" alt="" title=""/></div>
<div><img src="{{ STATIC_URL }}images/eclairs.jpg" alt="" title=""/></div>
</div>
<script>jssor_slider1_starter('slider1_container');</script>
</div>
</div>
<script>
jQuery(document).ready(function ($) {
var options = {
$FillMode: 4,
};
var jssor_slider1 = new $JssorSlider$('slider1_container', options);
//responsive code begin
//you can remove responsive code if you don't want the slider scales
//while window resizes
function ScaleSlider() {
var parentWidth = $('#slider1_container').parent().width();
if (parentWidth) {
jssor_slider1.$ScaleWidth(parentWidth);
}
else
window.setTimeout(ScaleSlider, 30);
}
//Scale slider after document ready
ScaleSlider();
$(window).bind("load", ScaleSlider);
$(window).bind("resize", ScaleSlider);
$(window).bind("orientationchange", ScaleSlider);
//responsive code end
});
</script>
</body>
</html>
Just added a max-width and max-height to my CSS, like this:
<style>
#slider1_container img {
max-width:100%;
max-height:100%;
}
</style>