开发者

ShareThis setting properties in callback don't work

I'm using the ShareThis widget开发者_运维问答. I need to change the url property after the object has been created so I'm using the callback function option. In the callback function, I attempt to change the url property but the email that goes out still contains the old value.

Has anyone been able to solve this problem? If so, I would appreciate your help!

Here's a code sample

<script type="text/javascript">

      SHARETHIS.addEntry({
          title: 'ShareThis'},
    { onclick: myCustomCallback }

      function myCustomCallback(SharedObject) {

        SharedObject.properties.url = "http://www.myurl.com";
        return true;
    };

</script>


Use this:

$('span[class^="st_"]').html(''); // Empty span contents

$('span[class^="st_"]').attr('st_processed',null); // Reset ST plugin

$('span[class^="st_"]').attr('st_url',url); // Set new url

stButtons.makeButtons(); // Renew buttons


It's not possible to change the URL dynamically. If you want to do something funky, you'll need to create a new button with the new URL. This can be accomplished a few ways, the simplest being creating an element to contain the button and trigger creation of a custom button element every time something happens that should trigger the URL change.

I can show you a sample implementation that we put together for HP a few weeks ago. They actually call the "share" function from inside a Flash movie, but this prototype triggers it from a button.

You can reach me at sragan@sharethis.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜