作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有时照片纵横比与幻灯片容器不同,我看到照片会被拉伸(stretch)以填充所有容器空间。
有没有办法避免这种情况,使照片纵横比不改变?当然会有一些空白,但照片中的形状没有改变。
最佳答案
请设置 $FillMode 选项,0:拉伸(stretch),1:包含,2:覆盖,4:实际尺寸,5:包含用于大图像,实际尺寸用于小图像。
值 1 或 2 或 4 将是保持纵横比的好选择
<script>
jQuery(document).ready(function ($) {
var options = {
$FillMode: 1, //[Optional] The way to fill image in slide, 0 stretch, 1 contain (keep aspect ratio and put all inside slide), 2 cover (keep aspect ratio and cover whole slide), 4 actuall size, 5 contain for large image and actual size for small image, default value is 0
$AutoPlay: true, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
$DragOrientation: 3 //[Optional] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)
};
var jssor_slider1 = new $JssorSlider$("slider1_container", options);
});
</script>
关于Jssor - 如何保持图像纵横比?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23865571/
我有一张 table 。我希望它的数据垂直和水平居中。 我使用了 align="center"valign="middle" ,但它没有用。
我是一名优秀的程序员,十分优秀!