Can you make fancyBox ignore title text when sizing media within an overlay?

冷暖自知 提交于 2019-12-23 03:39:06

问题


I'm using fancyBox 2.1.5 and displaying media with multi-line titles below them.

My problem is that fancyBox seems to be shrinking media in an attempt to fit long titles on-screen. Below I've attached screenshots from my iPhone, where it is most obvious.

Here the image is displayed at full size because I've removed the title:

Here the image is shrunken, trying to account for the long title:

I'd like fancyBox to ignore the title text when sizing media and always show it at full size, as seen in the first image. I'm OK with having to scroll to read all the title text.

Thanks for any help!


回答1:


If you are OK with having to scroll to read all the title text, then you can combine the fitToView and maxWidth options to have the size of your media the way you want it without ignoring the title like :

$(".fancybox").fancybox({
    fitToView: false, // avoids media to shrink to fit in the viewport
    margin: [20, 60, 20, 60],
    maxWidth: "90%", // avoids bigger media to stretch outside the viewport boundaries 
    helpers: {
        title: {
            type: "inside"
        }
    }
});

See JSFIDDLE



来源:https://stackoverflow.com/questions/20732013/can-you-make-fancybox-ignore-title-text-when-sizing-media-within-an-overlay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!