javascript - Is it possible to have full width JSSOR slider with fixed height? -
i'm trying use jssor slider on website. figured out how make full width it's "responsive" scales height of slide. have fixed height (400px) , 100% width. achieved "slider1_container" full width , 400px height content of still responsive.
there's website: http://carwash-horovice.cz
i appreciate can give me.
to scale jssor slider, keep aspect ratio. cannot scale without scaling height.
if want keep original height, can disable scaling removing following code.
function scaleslider() { var parentwidth = $('#slider1_container').parent().width(); if (parentwidth) { jssor_slider1.$scalewidth(parentwidth); } else $jssorutils$.$delay(scaleslider, 30); } scaleslider(); $(window).bind("load", scaleslider); $(window).bind("resize", scaleslider); $(window).bind("orientationchange", scaleslider); in addition, keep page responsive , keep slider auto center, can wrap slider wrapper.
<div style="position: relative; width: 100%; overflow: hidden;"> <div style="position: relative; left: 50%; width: 5000px; text-align: center; margin-left: -2500px;"> <!-- use 'margin: 0 auto;' auto center element in parent container --> <div id="slider1_container" style="...margin: 0 auto;..." ...> </div> </div> </div>
Comments
Post a Comment