I tried to find the solution but can't. I need a custom image for Pinterest (Pin It) button and pin some custom image by url but not a current page.
I created a custom link:
<a href="http://pinterest.com/pin/create/button/?url=http://inspired-ui.com&media={ImageURL}&description=DescriptionText" class="pinitbutton">Pin It</a>
in style I set the background image but I see only default Pin It button and not my custom button
There are some solutions where you can set custom button image for Pin It button but I can't change the media={ImageURL} in those solutions.
The popular solution is
<a href='javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());'><img src='http://www.brandaiddesignco.com/blog/PinIt.png'/></a>
But it doesn't help me. Does any one know the solution?
Works for me perfectly. Your script
Call it with
After a bit of trial and error, below is what worked for me. This response is a combination of @rharvey's response thread and another stack overflow post. This solution opens up a pop up to share content via pinterest.
Note: In order to prevent 2 windows from popping up you need to set a target. Below is the full solution:
At the risk of over simplifying things, use your
'http://pinterest.com/pin/create/button/?url='
path that you've already got, set up your variables, and append them as you do, and just don't include any pinterest javascript. Without that js, it won't find the link and replace it out with their own pinterest button. Just customize your link with an image inside it (or set a background image or whatever) and screw the pinterest js. Set the target to open in a new window.Here is what worked for me :
The attribute data-pin-custom is what I picked up from Pinterest documentation.
Hope this helps.
Adding an encoded whitespace before the last fragment of the URL will prevent Pinterest's JS from "hijacking" the link:
Update:
It seems that my previous solution doesn't work anymore. Here is another one:
Custom Link/Button looks like this:
Note: I don't think the data attributes need to be encoded (like I did for data-image) but it doesn't seem to hurt it.
JQuery: