使用单个URL创建Stumbleupon按钮

时间:2012-11-06 16:08:25

标签: stumbleupon

我希望能够在我的所有网站页面上都有stumbleupon按钮,但始终拥有它" Stumble"我的主页。如何将此功能添加到Button?

这是Stumbleupon给我的东西:

< ! - 将此标记放在您希望渲染su徽章的位置 - >

< su:badge layout="5" >< /su:badge >

&LT; ! - 将此代码段放在适当位置 - &gt;

< script type="text/javascript"><br>
  (function() {
    var li = document.createElement('script'); li.type = 'text/javascript'; li.async = true;
    li.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + '//platform.stumbleupon.com/1/widgets.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(li, s);
  })();
< /script>

这是我的网站fairivy.com

谢谢!

2 个答案:

答案 0 :(得分:2)

您希望展示徽章的位置,请编辑以下代码:

    <su:badge layout="5"></su:badge>

对此:

    <su:badge layout="5" location="http://www.fairivy.com/"></su:badge>

答案 1 :(得分:1)

您可能必须自定义stumblupon提供的js脚本,尝试在JS中更改此行,并将其托管在您自己的网站上:

if(this.type=='follow')
return scheme+'www.'+ this.domain+ followBase+'?id='+ this.ref+'&l='+ this.layout;else if(this.type=='bestof')
return scheme+'www.'+ this.domain+ bestofBase+'?'+ this.request.join('&')+'&l='+ this.layout+'&title='+ encodeURIComponent(this.title);

如果你使用这个解决方案,你可能只需要与你的主域名分开.js。

您还需要将此行更改为自定义位置:

'//platform.stumbleupon.com/1/widgets.js'