需要更改 JSSOR Slider Min-Height
JSSOR Slider Min-Height change needed
"jssor slider will always keep aspect ratio while scale. so min-height is not reasonable"
大家好,我需要一个图像的最小高度功能,以保持我的页面布局一致。
有谁知道怎么修改js代码吗?
灵活的动态宽度很好,但在某些时候我需要一个最小高度来将图像锚定到一致的页面布局。
谢谢
//responsive code begin
//you can remove responsive code if you don't want the slider scales while window resizes
function ScaleSlider() {
var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth;
if (parentWidth) {
//for example minHeight is 300;
var minHeight = 300;
var newWidth = parentWidth;
var newHeight = jssor_slider1.$OriginalHeight() / jssor_slider1.$OriginalWidth() * newWidth;
if (newHeight < minHeight)
jssor_slider1.$ScaleHeight(minHeight);
else
jssor_slider1.$ScaleWidth(parentWidth);
}
else
window.setTimeout(ScaleSlider, 30);
}
ScaleSlider();
$(window).bind("load", ScaleSlider);
$(window).bind("resize", ScaleSlider);
$(window).bind("orientationchange", ScaleSlider);
//responsive code end
"jssor slider will always keep aspect ratio while scale. so min-height is not reasonable"
大家好,我需要一个图像的最小高度功能,以保持我的页面布局一致。
有谁知道怎么修改js代码吗?
灵活的动态宽度很好,但在某些时候我需要一个最小高度来将图像锚定到一致的页面布局。
谢谢
//responsive code begin
//you can remove responsive code if you don't want the slider scales while window resizes
function ScaleSlider() {
var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth;
if (parentWidth) {
//for example minHeight is 300;
var minHeight = 300;
var newWidth = parentWidth;
var newHeight = jssor_slider1.$OriginalHeight() / jssor_slider1.$OriginalWidth() * newWidth;
if (newHeight < minHeight)
jssor_slider1.$ScaleHeight(minHeight);
else
jssor_slider1.$ScaleWidth(parentWidth);
}
else
window.setTimeout(ScaleSlider, 30);
}
ScaleSlider();
$(window).bind("load", ScaleSlider);
$(window).bind("resize", ScaleSlider);
$(window).bind("orientationchange", ScaleSlider);
//responsive code end