简体   繁体   English

花式盒子适合容器的图像

[英]fancybox fit image to the container

I tried different answers from here but the results is still the same.. I am getting confused about this, I actually got the result i want.我从这里尝试了不同的答案,但结果仍然相同......我对此感到困惑,我实际上得到了我想要的结果。 But I'm having problem in fancybox, i would like to fit my image to the container of the fancybox.但是我在fancybox 中遇到了问题,我想将我的图像放入fancybox 的容器中。 ( will upload photo) image when not clicked yet / image when inside fancybox (将上传照片)尚未点击时的图像/在fancybox中时的图像

Another sample, image when not yet clicked / image inside fancybox I am using this code另一个示例,尚未单击时的图像/ fancybox 中的图像我正在使用此代码

PS: this is in a forum, so images will be random.. PS:这是在论坛里,所以图片将是随机的..

$("#post_message_{vb:raw post.postid}").css({'transform': 'rotate(+90deg) translate(-56%)','transform-origin': 'bottom left','white-space': 'nowrap','max-height': '650px'});

$("#post_message_{vb:raw post.postid} ").css({'padding': '0% 0px 24% 0px','height': '0','display': 'table'});

$(document).ready(function() {
    $("#post_message_{vb:raw post.postid}").fancybox({                   
        beforeShow: function () {
            $(".fancybox-inner").css({
                "overflow-x": 'hidden'
            });
        },
        'autoSize': false,
        'fitToView': false,
        'autoResize': false,
        'autoCenter': false
    });               
});     

Use CSS to make your image 100% width or maybe set object-fit: cover;使用 CSS 使您的图像宽度为 100% 或设置object-fit: cover; ( https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit ). https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit )。 Basically, jut do everything you would do without fancybox.基本上,只要没有fancybox就可以做任何事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM