admin管理员组文章数量:1389838
I'm trying to use JSSOR slider on a website. I already figured out how to make it full width but now it's all "responsive" so it scales even the height of the slide. I would like to have fixed height (400px) and 100% width. I almost achieved it so the "slider1_container" is full width and 400px height but the content of it is still responsive.
There's the website:
I appreciate any help you can give me.
I'm trying to use JSSOR slider on a website. I already figured out how to make it full width but now it's all "responsive" so it scales even the height of the slide. I would like to have fixed height (400px) and 100% width. I almost achieved it so the "slider1_container" is full width and 400px height but the content of it is still responsive.
There's the website: http://carwash-horovice.cz
I appreciate any help you can give me.
Share Improve this question asked Aug 18, 2014 at 20:35 Jakub ŠtychJakub Štych 531 silver badge3 bronze badges3 Answers
Reset to default 1To scale jssor slider, it will always keep aspect ratio. You cannot scale with without scaling height.
If you want to keep the original height, you can disable scaling by removing the 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, to keep your page responsive and keep the slider auto center, you can wrap the slider by a 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;' to auto center element in parent container -->
<div id="slider1_container" style="...margin: 0 auto;..." ...>
</div>
</div>
</div>
You have an example with the slider at full screen.
http://www.jssor./testcase/full-screen-slider.source.html
This is what I'm looking for, but with a limited height. I don't want the aspect ratio of the images to change, but as in the full-screen version, I'd like it to expand to fill the width, and simply crop what doesn't fit within the fixed height. Is this possible?
You can fix the height of the carousel by menting out $(window).bind("resize", ScaleSlider);
本文标签: javascriptIs it possible to have full width JSSOR slider with fixed heightStack Overflow
版权声明:本文标题:javascript - Is it possible to have full width JSSOR slider with fixed height? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744618150a2615856.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论