在 Fancybox 下面添加描述文本而不是使用标题属性?

发布于 2025-01-01 18:19:55 字数 942 浏览 1 评论 0原文

有没有什么方法可以在 Fancybox 框中添加文本而不必使用 title 属性?为了说明我遇到的问题,这是我的页面上显示的使用 Fancybox 的图片之一:

http://dl.dropbox.com/u/12453703/fbox01.PNG

如您所见,对于标题属性,我已将其放入 HTML 中,以便图片标题是一个链接到网页。它看起来不错,而且工作得很好。然而,糟糕的是,当我指向 Fancybox 的缩略图时,我得到了原始 HTML 代码:

http://dl.dropbox.com/u/12453703/fbox02.png

有一些解决方法吗?放大图像中包含 HTML 链接,但仅包含弹出的缩略图工具提示文本?或者也许(正如我的标题所示),在图像下方有一些与标题文本分开的单独文本?

(我在 Fancybox 文档中没有找到任何关于此问题的有用信息,但我可能是错的。)

谢谢。

  • 编辑,我现在使用的代码非常简单:
$("a.single_image").fancybox(
{
    transitionIn: 'elastic',
    transitionOut: 'elastic',
    easingIn: 'easeInOutBack',
    easingOut: 'easeOutBack',
    speedIn: 300,
    speedOut: 300,
    cyclic: true    ,
    titlePosition: 'over',
});

Is there any way to perhaps add text in a Fancybox box rather than having to use the title attribute? To illustrate the problem I'm having, here's one of the pictures displayed on my page which uses Fancybox:

http://dl.dropbox.com/u/12453703/fbox01.PNG

As you see, for the title attribute I have put in HTML so that the picture title is a link to a webpage. It looks good and it works just fine. However, the bad thing is, when I point to the thumbnail for the Fancybox, I get the raw HTML code:

http://dl.dropbox.com/u/12453703/fbox02.png

Is there some workaround for this? Have the HTML link in the enlarged image, but simply have text for the thumbnail tooltip which pops up? Or perhaps (as my title suggests), have some seperate text below the image which is seperate from the caption text?

(I didn't find anything useful regarding this issue in the Fancybox docs but I could be wrong.)

Thanks.

  • Edit, the code I'm using at the moment is quite simple:
$("a.single_image").fancybox(
{
    transitionIn: 'elastic',
    transitionOut: 'elastic',
    easingIn: 'easeInOutBack',
    easingOut: 'easeOutBack',
    speedIn: 300,
    speedOut: 300,
    cyclic: true    ,
    titlePosition: 'over',
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你不是我要的菜∠ 2025-01-08 18:19:55

为您的链接创建一个新的attribute,我将其命名为rel

<a href="myimg.jpg" class="single_image" rel="My Title"><img src="myimg.jpg" /></a>

$("a.single_image").each(function(){
    $(this).fancybox({
        transitionIn: 'elastic',
        transitionOut: 'elastic',
        easingIn: 'easeInOutBack',
        easingOut: 'easeOutBack',
        speedIn: 300,
        speedOut: 300,
        cyclic: true    ,
        titlePosition: 'over',
        title:  $(this).attr('rel')
    });
})

Create a new attribute for your link, I will just call it rel:

<a href="myimg.jpg" class="single_image" rel="My Title"><img src="myimg.jpg" /></a>

$("a.single_image").each(function(){
    $(this).fancybox({
        transitionIn: 'elastic',
        transitionOut: 'elastic',
        easingIn: 'easeInOutBack',
        easingOut: 'easeOutBack',
        speedIn: 300,
        speedOut: 300,
        cyclic: true    ,
        titlePosition: 'over',
        title:  $(this).attr('rel')
    });
})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文