简体   繁体   English

Drupal-在输出链接中使用具有Views(Rel属性)的灯箱

[英]Drupal - Use lightbox with Views (Rel attribute) - in output link

In Drupal I have two image fields, one to act as a thumbnail and the other the image that will open when the thumbnail is clicked. 在Drupal中,我有两个图像字段,一个用作缩略图,另一个是单击缩略图时将打开的图像。 The only way I could find to link the two was to use the option for "Output this field as a link" and link to the image field. 我找到链接两者的唯一方法是使用“输出此字段作为链接”选项并链接到图像字段。

This works, so when I click the thumbnail it opens the larger image however I would like to use lightbox2 for this task but in the "Output this field as a link" options there is no way to set the "rel" attribute. 这是可行的,因此当我单击缩略图时,它将打开较大的图像,但是我想使用lightbox2来完成此任务,但是在“将此字段输出为链接”选项中,无法设置“ rel”属性。

Is there a way to either set the rel attribute or invoke the lightbox by setting a class? 是否可以通过设置类来设置rel属性或调用灯箱?

you only need a single cck imagefield to get thumbnail plus full image in lightbox: Lightbox2 - How to use with CCK Imagefield and Imagecache . 您只需要一个cck imagefield即可在lightbox中获取缩略图和完整图像: Lightbox2-如何与CCK Imagefield和Imagecache一起使用

UPDATE : use the "Lightbox Trigger" Views field of the Lightbox2 development version . 更新使用 Lightbox2开发版本 的“灯箱触发器”视图字段 step by step: 一步步:

  • add both your thumbnail and your image field to your view 将您的缩略图和图像字段都添加到视图中
  • mark both of them "Exclude from display". 将它们都标记为“不显示”。 don't check "Output this field as a link" anywhere. 不要在任何地方选中“将此字段输出为链接”。
  • add a "Lightbox trigger" field after both of your image fields 在两个图像字段之后添加“灯箱触发器” 字段
  • configure the "Lightbox trigger" field: 配置“灯箱触发器”字段:
    • for "Trigger field", select your thumbnail field 对于“触发字段”,请选择您的缩略图字段
    • for "Popup", select the Replacement pattern (scroll further down in the view field edit form for all possible replacement pattern) of your image field. 对于“弹出”,选择图像字段的替换图案 (对于所有可能的替换图案,在视图字段编辑表单中向下滚动)。 for example, in my case, this is [field_image_fid] . 例如,在我的情况下,这是[field_image_fid]

now, your view should show your thumbnail image and, clicking on it, should open your full image in a lightbox frame. 现在,您的视图应显示您的缩略图,然后单击该缩略图应在灯箱框架中打开完整的图像。 at least that's what's happening here :) 至少这就是这里发生的事情:)

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

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