Pinterest配置文件小部件不能一直工作

时间:2013-12-03 19:52:26

标签: html css web widget pinterest

我在构建网站时通常按照我的方式将Pinterest配置文件小部件添加到我的网站。通常它工作正常,但由于一些奇怪的原因,这次有时它显示,有时它不...这是我正在谈论的网站:http://bav.kadushimarketing.com/index4.php

这是我添加的代码:<a data-pin-do="embedUser" href="http://www.pinterest.com/bonaireartvilla/" data-pin-scale-width="65" data-pin-board-width="230">Bonaire Art Villas's profile on Pinterest</a>

这是我添加的脚本:

<script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>

我在这个网站上有很多其他脚本。这些脚本是否可能相互冲突?有办法检查吗?

8 个答案:

答案 0 :(得分:2)

在我的情况下,如果在pinit.js初始化期间父div元素上有“display:none”样式,则Pinterest小部件不会加载自身。当我从父节点中删除该样式时,小部件最终用一堆包含小部件数据的跨度替换了a-tag。

非常奇怪的行为,但有一个解决方案......

答案 1 :(得分:0)

我包含了一个非常简单的“点击显示元素”jQuery脚本,与Pinterest脚本冲突。

答案 2 :(得分:0)

您必须将Pinterest的标记放在站点代码的末尾,就在结束BODY标记的上方。

答案 3 :(得分:0)

在头部

中添加这两个js文件
<script type="text/javascript" async defer src="js/pinit.js"></script>
<script type="text/javascript" async defer src="js/pinit_main.js"></script>

从这里保存文件: http://assets.pinterest.com/js/pinit.js

http://assets.pinterest.com/js/pinit_main.js

这将起作用101%

答案 4 :(得分:0)

在结束<script type="text/javascript"> (function(d){ var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT'); p.type = 'text/javascript'; p.async = true; p.src = '//assets.pinterest.com/js/pinit.js'; f.parentNode.insertBefore(p, f); }(document)); </script> 标记之前添加此代码:

{{1}}

答案 5 :(得分:0)

我添加到小部件链接style =“display:block!important”

现在都在工作

答案 6 :(得分:0)

为小部件添加此行

     <a data-pin-do="embedUser" data-pin-board-width="400" data-pin-scale-height="240" data-pin-scale-width="80" href="https://www.pinterest.co.uk/jojomamanbebe/"></a>

在结束Body标记

之前添加这两行
<script type="text/javascript" async defer src="https://assets.pinterest.com/js/pinit.js"></script>
<script type="text/javascript" async defer src="https://assets.pinterest.com/js/pinit_main.js"></script>

答案 7 :(得分:-1)

这对我来说很少有用,除了Pinterest小部件页面拼写的内容外,我没有做任何其他事情。在过去,我不得不求助于一些非常hacky的方法,例如使用jQuery的.one()绑定函数在单击特定元素时将pinit.js代码附加到页面。

更新:呃,我的坏。 (:P)我试图引用一个包含在棋盘小部件中的配置文件 - 不可行。切换到配置文件小部件有很大帮助。我仍然有点麻烦让小部件显示在某些设备上,但我确实得到了它。