jQuery:改变fancybox的宽度 [英] jQuery: change fancybox width

查看:106
本文介绍了jQuery:改变fancybox的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站上显示不同类型的图片。附加到每个图像我想添加一些文字。我在html文档的title-element中写了这个文本。这段文字长了几句。

I'm showing different types of images on a site. Attached to every image I want to add some text. I have written this text in the title-element in the html document. This text is a few sentences long.

现在发生的事情是fancybox变得非常狭窄(因为图片非常小)而且文本看起来非常愚蠢。我试图改变fancybox代码中的宽度和高度值,但它似乎仍然无法正常工作。我试图在css中修复它,并且我得到了标题文本变得更宽,但是fancybox仍然太窄,所以文本部分在AND外部到框内。

What happens now is that the fancybox becomes really narrow (since the picture is quite small) and the text looks really stupid. I've tried to change the width and height values within the fancybox code, but it still doesn't seem to work. I tried to fix it in css too, and I got the title text to become wider, but the fancybox was still too narrow, so the text was partly within AND outside to box.

如何将fancybox大小更改为固定大小,以便标题文本看起来不那么愚蠢?

How can I change the fancybox size to a fixed size so that the title text won't look so visually stupid?

到目前为止,我已经这样做了:

So far I have done this:

jQuery:

$(".fancybox").fancybox({
    helpers : {
        title: {
            type: 'inside',
            position: 'top',
        }
    },
            openSpeed: 'slow',
            closeSpeed: 'slow',
});

CSS

.fancybox {
    width: 600px;
    height: 600px;
}

.fancybox-title {
  width: auto;
  height: auto;
}

.fancybox-title .child {
  min-width: auto; 
  height: auto;
}


推荐答案

您可以使用:

$(".fancybox").fancybox({
    autoDimensions: true
});

阅读文档: http://fancybox.net/api

这篇关于jQuery:改变fancybox的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆