使用Google + 1按钮的自定义图片?

per*_*mas 58 google-plus-one

我想在页面上添加"google + 1"按钮,但我想使用自定义大小的自定义图像,最好不使用javascript,这与Facebook和Twitter很可能有关.我不在乎它现在是否显示计数.

Aav*_*iya 82

最后!找到了解决这个问题的好方法.如此简单和工作:)希望它可以帮助你!

<a href="https://plus.google.com/share?url=ADD_YOUR_URL" >
    <img src="path_to_your_image" alt="Google+" title="Google+"/>
</a>
Run Code Online (Sandbox Code Playgroud)

资料来源:http://notesofgenius.com/how-develop-custom-google-plus-button/

  • 有一个更新的网址:https://plus.google.com/share?url = [urL].如果您将其作为弹出窗口打开,它会自动调整大小以适应窗口,与原始链接不同. (10认同)
  • 只是一点警告.分享与+1不同."将此按钮添加到您网站上的内容,以便在Google+上轻松共享.此按钮非常适合用户可能想要分享但不能+1的内容(例如新闻或有争议的内容)." https://developers.google.com/+/web/share/ (8认同)
  • 在这种情况下,无法获得回调. (2认同)

Ghi*_*igo 13

这是谷歌开发者页面的官方示例:

还要考虑URL已更新.

<a href="https://plus.google.com/share?url={URL}" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
  <img src="https://www.gstatic.com/images/icons/gplus-64.png" alt="Share on Google+"/>
</a>
Run Code Online (Sandbox Code Playgroud)


Sor*_*ati 6

使用不透明度0只是让它不可见.然后使用背景使它看起来像你想要的.

<style>
.my_custom_googleplusone{
overflow: hidden;
background: url(blahblah.png);
}

.my_custom_googleplusone:hover{
background: url(blahblah2.png);
}
</style>

<div class="my_custom_googleplusone">
  /// GOOGLE BUTTON WITH OPACITY OF 0 (and z-index 1 with absolute position);
</div>
Run Code Online (Sandbox Code Playgroud)