3

I'm having problems with the Tweet button. Here is the code that Twitter provides:

    <a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

I'm loading this into a modal that pops up over my page. It works great the first time it's loaded, but if someone closes the modal and reopens it, it doesn't load the button anymore.

Brenden
  • 8,264
  • 14
  • 48
  • 78
  • 1
    I think it would help if you'd provide further information on how you create the modal "popup". – pagid Jan 04 '12 at 18:25

1 Answers1

5

You could try adding Twitter's widgets.js as a regular script include within your <head>, and then once you have rendered your modal you can call

twttr.widgets.load();

which should refresh any twitter buttons it finds.

This means you don't need the block from the supplied snippet, your tweet buttons are just of the form

<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
rejj
  • 1,216
  • 7
  • 13