html - 将图像悬停在 AMP-Pinterest Pin It 按钮上

标签 html amp-html

我将 AMP-Pinterest 添加到了我的 AMPed 页面。我想设置属性 data-pin-hover="true"获取图像上的 PinIt 按钮。由于某种原因它不起作用。

这是我到目前为止所拥有的:

位于<head> :

 <script async custom-element="amp-pinterest" src="https://cdn.ampproject.org/v0/amp-pinterest-0.1.js"></script>

(当然还有其他 AMP 内容)

位于<body> :

<amp-pinterest height=28 width=56
    data-do="buttonPin"
    data-url="URL"
    data-media="IMG_URL"
    data-pin-hover="true"
    data-description="DESC">
</amp-pinterest>

我还添加了data-pin-nopin="false"data-pin-no-hover="false"给我的amp-img's声明(以防万一,如果它不是默认设置为 false。更多信息请参见: https://www.ampproject.org/docs/reference/components/amp-pinterest ):

<amp-img alt="NAME" src="IMG_URL" width="600"
height="400" layout="responsive"  data-pin-nopin="false"
data-pin-no-hover="false" />

但它仍然不起作用(PinIt 按钮显示在 amp-img 上方/下方)。

问题: 现在我想知道我是否做错了什么,或者根本不支持使用 AMP-Pinterest 悬停图像? (我找不到任何例子)。

最佳答案

不幸的是,此选项目前不适用于 amp-pinterest(查看文档和其他示例)。但是,如果您不希望“固定”按钮不出现在上方或下方,则可以将其嵌入图像中,如 amp-pinterest samples 中所示。 :

Embed pin widget

To embed the pin widget, set data-do to embedPing. The data-url attribute must contain the fully-qualified URL of the Pinterest resource.

关于html - 将图像悬停在 AMP-Pinterest Pin It 按钮上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41555915/

相关文章:

amp-html - AMP 在 Show More 上显示加载指示器

html - jsfiddle 和 codepen 上相同的 html/css 代码之间无法解释的区别

javascript - 在 Svelte 中, `:` 中的 `on:click` 是如何工作的?

mustache - AMP : How to handle complex conditional logic in AMP?

seo - AMP 错误 : Missing supported structured data element

phpstorm - PhpStorm 中的自定义 Google AMP 标签和属性?

html - 平铺背景图像成本带宽

html - 在内部 Div 中垂直居中链接

html - 在 CSS 中居中容器,删除第 4 个框后

google-chrome - 移动浏览器将如何以及何时开始提供 AMP(加速移动页面)内容?