4

我网站上的每个帖子都包含一个照片库。画廊由链接到全尺寸图像的缩略图组成。我还在我的帖子中放置了一个 PinIt 按钮。问题是它会捕获缩略图以供钉住。

根据我对此类问题的发现,我最终得到了以下代码,该代码应从 pining 中排除缩略图,并改为包含全尺寸图像。这些都不是,虽然...

<a href="path_to_full_image" rel="lightbox[single_post]" pi:pinit:media="path_to_full_image">
     <img src="path_to_thumbnail" width="200" height="130" nopin="nopin" />
</a>

有什么建议么?

4

2 回答 2

2

我们可以通过使用nopin = "nopin"image 属性来避免在 pin 动作中显示图像。

例如,

<img src="http://via.placeholder.com/350x150" nopin = "nopin" />
于 2017-06-24T14:27:05.977 回答
0

In order for the PinIt button to pick full-size images they should be loaded and visible on the page. Since they are not, it cannot grab them to the grid gallery. As a workaround I would suggest to have a custom logic that pre-loads full-sized images before triggering the PinIt button click event. Something like this:

$('a[rel="lightbox"]').each(function(){
  image_src = $(this).attr('href');
  $('<img/>').attr('src',image_src).appendTo('#imageContainer');
  ;
})
$('#pinItButton').trigger('click');

This way you will pre-load all the images and put them into imageContainer block and then trigger a click that will open Grid Gallery to pick an image.

Hope it helps.

于 2013-11-28T11:27:08.873 回答