回调中的 ShareThis 设置属性不起作用
我正在使用 ShareThis 小部件。我需要在创建对象后更改 url 属性,因此我使用回调函数选项。在回调函数中,我尝试更改 url 属性,但发出的电子邮件仍然包含旧值。
有人能够解决这个问题吗?如果是这样,我将非常感谢您的帮助!
这是一个代码示例
<script type="text/javascript">
SHARETHIS.addEntry({
title: 'ShareThis'},
{ onclick: myCustomCallback }
function myCustomCallback(SharedObject) {
SharedObject.properties.url = "http://www.myurl.com";
return true;
};
</script>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用这个:
Use this:
无法动态更改 URL。如果您想做一些有趣的事情,则需要使用新 URL 创建一个新按钮。这可以通过几种方式来完成,最简单的是创建一个元素来包含按钮,并在每次发生应触发 URL 更改的事件时触发自定义按钮元素的创建。
我可以向您展示几周前我们为 HP 制作的示例实施。他们实际上是从 Flash 影片内部调用“共享”功能,但这个原型是通过按钮触发的。
您可以通过[电子邮件受保护]与我联系
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 [email protected]