How to set custom jssor slider width and height
Using $ScaleWidth
or $ScaleHeight
, I can set either the Width or Height of the jssor slider that maintains the aspect ratio:
JQuery
var jssor_slider1 = new $JssorSlider$('slider1')
jssor_slider1.$ScaleWidth(500);
HTML:
<div id="slider1" style="position:relative;top:0px;left:0px; width:600px;height:300px;">
<!-- Slides Container -->
<div u="slides" ....
But I need to set a custom width and height; does not look like the aspect ratio as above.
Let's assume starting width = 600px and height = 300px.
Can I update the width to 1200px and the height to 400px ?
source to share
Since no one has answered, @jssor's comments to my question are the current answer:
By scaling the jssor slider it will always keep the aspect ratio. You can use either
$ScaleWidth
or$ScaleHeight
to zoom slider jssor, and finally, the aspect will remain unchanged. If you scale the width to 1200px the height will be 600px.As a workaround, you can put the jssor slider in a container. You can scale the container and the aspect ratio is entirely up to you. - Jssor
source to share