FancyboxとPinterestのピンボタンの両方があるページがあります。どちらも正常に機能しているようですが、Fancyboxオーバーレイを閉じると、次のJavaScriptエラーが表示されます。
Uncaught TypeError: Cannot read property 'data-pin-aha' of null
私のPinterestボタンは次のようにレンダリングされます:
<a href="http://pinterest.com/pin/create/button/?url=http://www.mywebsite.com/somepage&media=http://www.mywebsite.com/content/images/2c63a4e0-3b65-4464-934c-77f2a7166090-Dim459X612.jpg&description=some description" class="PIN_1354830754034_pin_it_button PIN_1354830754034_pin_it_beside PIN_1354830754034_hazClick" data-pin-aha="button_pinit" data-pin-config="beside"><span class="PIN_1354830754034_pin_it_button_count" id="PIN_1354830754034_pin_count_0"><i></i>3</span></a>
楽しみのために、私のPinterestボタンはこれと非同期にロードされています:
(function () {
window.PinIt = window.PinIt || { loaded: false };
if (window.PinIt.loaded) return;
window.PinIt.loaded = true;
function async_load() {
var s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
if (window.location.protocol == "https:")
s.src = "https://assets.pinterest.com/js/pinit.js";
else
s.src = "http://assets.pinterest.com/js/pinit.js";
var x = document.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
window.attachEvent("onload", async_load);
else
window.addEventListener("load", async_load, false);
})();
そして私のFancyboxリンク:
<a href="//vimeo.com/36573701" class="watch"><span>Watch Our Story</span></a>
全体的に、それはかなり基本的な設定です。キックのためだけに、Pinterestの通常のインラインスクリプトタグを使用しましたが、同じエラーが発生しました。
誰かがこのエラーを見て、それを修正する方法を知っていますか?