I have a page that has both Fancybox and a Pinterest pin button. Both seem to work as they should, but when I close the Fancybox overlay I see the following JavaScript error:
Uncaught TypeError: Cannot read property 'data-pin-aha' of null
My Pinterest button renders as this:
<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>
Just for fun, my Pinterest button is being loaded asynchronously with this:
(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);
})();
And my Fancybox link:
<a href="//vimeo.com/36573701" class="watch"><span>Watch Our Story</span></a>
Overall it's a pretty basic setup. Just for kicks I used the normal inline script tag for Pinterest, but got the same error.
Has anyone ever seen this error and know how to fix it?