Pinterest: How to exclude images from being pinned via jQuery.

Say you have Pinterest setup on your site to allow pinning or saving of images. However, you obviously don't want this enabled for all images (ex: menu images, footer images, etc).

Here's how to exclude certain images from being recognized by Pinterest:

<script async defer data-pin-hover="true" data-pin-save="true" src="//assets.pinterest.com/js/pinit.js"></script>
 
<script>
    $j(document).ready(function() {
        $j('.menu-item img, .footer img , .ambanners img').attr({
            'data-pin-no-hover': 'true',
            'data-pin-nopin': 'true'
        });
    });
</script>

In Magento, you would add the following to your local.xml, under <reference name="head">:

        <block type="core/text" name="pintrest.image">
           <action method="setText">
              <text>
                <![CDATA[
 
                  <script async defer data-pin-hover="true" data-pin-save="true" src="//assets.pinterest.com/js/pinit.js"></script>
 
                  <script> 
                  $j(document).ready(function() {
                    $j('.menu-item img, .footer img , .ambanners img').attr({ 
                      'data-pin-no-hover': 'true',
                      'data-pin-nopin': 'true'
                    });
		          });
                  </script>
 
                ]]>
              </text>
           </action>
        </block>
Tags: jquery pinterest magento