1

I am using jssor`s simple fade slider and It is working fine but there is an issue with height and width ..

Actually I am using the width as percentage and the problem cause by it is that as I increases width height also increases similarly for vice versa..

What I want is height of the slider remain fixed but the width changes accordingly ..

Zain Abbas
  • 111
  • 3
  • 15

1 Answers1

0

The most I've been able to do is get the slider to scale the width before initializing, essentially working like 100% width and fixed height.

The only problem is it doesn't scale if the window resizes.

Either way, for anyone interested, just update the slider container divs with JS right before you initialize Jssor:

<!-- Jssor Trigger -->
<script>
    var parentWidth = document.getElementById('slider').offsetWidth;
    document.getElementById('slider1_container').style.width=parentWidth+'px';
    document.getElementById('slider1_slides').style.width=parentWidth+'px';
    jssor_slider1_starter('slider1_container');
</script>

If your page has a vertical scrollbar, you might have to call this code after the ending tag of the div you're getting your width value from, or simply just before closing the body tag.

ricardomsouto
  • 51
  • 1
  • 4