How can i rerender Pinterest's Pin It button?

前端 未结 13 2163
暖寄归人
暖寄归人 2021-01-30 18:14

I\'m trying to create and manipulate the Pin It button after page load. When i change the button properties with js, it should be rerendered to get the functionality of pinning

13条回答
  •  攒了一身酷
    2021-01-30 18:40

    I built on Derrek's solution (and fixed undeclared variable issue) to make it possible to dynamically load the pinterest button, so it can't possibly slow down load times. Only tangentially related to the original question but I thought I'd share anyway.

    at end of document:

    
    

    in document ready function:

    addPinterestButton('pageURL', 'img', 'description');//replace with actual data
    

    in your document where you want the pinterest button to appear, just add an element with the id pinterestOption, i.e.

    hope that helps someone!

提交回复
热议问题