How can i rerender Pinterest's Pin It button?

前端 未结 13 2144
暖寄归人
暖寄归人 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:44

    The official way to do this is by setting the "data-pin-build" attribute when loading the script:

    
    

    Then you can render your buttons dynamically like so:

    // render buttons inside a scoped DOM element
    window.parsePins(buttonDomElement);
    
    // render the whole page
    window.parsePins();
    

    There is also another method on this site which lets you render them in JavaScript without the script tag.

提交回复
热议问题