此解决方案使所有图像都显示为全高.如果它高于视口,则必须滚动才能完全看到它.
此外,它永远不会超过图像尺寸.它只是允许您以原始大小查看它
jQuery(document).ready(function(jQuery) {
jQuery('.trigger').magnificPopup({
type: 'image',
callbacks: {
resize: changeImgSize,
imageLoadComplete:changeImgSize,
change:changeImgSize
}
});
});
function changeImgSize(){
var img = this.content.find('img');
img.css('max-height', '100%');
img.css('width', 'auto');
img.css('max-width', 'auto');
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4532 次 |
| 最近记录: |