获取Fancybox与Plone的新闻项目图像合作 [英] Get Fancybox to cooperate with Plone's News Item image

查看:60
本文介绍了获取Fancybox与Plone的新闻项目图像合作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Plone和Fancybox的新闻项播放不佳感到困扰.因此,对于新闻项目,图像直接与内容项目一起上载并存储在http://yoursite.com/the-news-item/image中.显示的图像带有指向/the-news-item/image_view_fullscreen的默认链接.

I had a problem with Plone and Fancybox not playing nicely on News Items. So, for News Items, the image is uploaded directly with the content item and is stored at http://yoursite.com/the-news-item/image. The image is displayed with a default link to /the-news-item/image_view_fullscreen.

我让Fancybox可以处理大多数其他图像,但是无法使.js与此图像一起使用.我的.js调用看起来像:

I have Fancybox working on most other images fine, but couldn't get the .js to work with this image. My .js call looked like:

<script type="text/javascript">
  $(document).ready(function() {
    /* Simple image gallery. Uses default settings */
    $("a[href$='.jpg'],a[href$='.png'],a[href$='.gif'],a[href$='/image']").attr('rel', 'gallery').fancybox();
  });
</script>

我将默认链接更改为/the-news-item/image.使用这种方法,链接保持为静态链接,而该静态链接在新页面中打开了图像.

And I changed the default link to /the-news-item/image. With this method, the link remained as just a static link that opened up the image in a new page.

推荐答案

如果未自定义链接,则Nachtigall的建议有效.

Nachtigall's proposal works, if the link hasn't been customized.

在将其自定义为"/image"后,将其添加到href-selector链中,并通过将"fancybox.image"类应用于链接中的链接,还告诉fancybox它正在处理的是MIME类型.新闻项目的模板.

As you have customized it to '/image', add that to your href-selector-chain and additionally tell fancybox which MIME-Type it is dealing with, by applying the class 'fancybox.image' to the link in the news-item's template.

引用文档:

脚本使用匹配元素的href或data-fancybox-href属性来获取内容的位置并找出要显示的内容类型.您可以通过添加类名直接指定类型(fancybox.image, fancybox.iframe等)"

"Script uses the href or data-fancybox-href attribute of the matched elements to obtain the location of the content and to figure out content type you want to display. You can specify type directly by adding classname (fancybox.image, fancybox.iframe, etc)"

这篇关于获取Fancybox与Plone的新闻项目图像合作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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