Tumblr 上的快速点赞按钮
谁能解释一下这个页面中的“赞”按钮是如何工作的?
正如您所看到的,一旦整个页面加载完毕,将鼠标悬停在帖子或图片上会显示几个按钮,包括一个“喜欢”按钮(左下角的心形按钮)。
有人能解释一下它是如何工作的吗?我已经尝试弄清楚它有一段时间了,尝试了源代码上的脚本,但无济于事。
Can anybody explain me how the like button in this page works?
As you can see,once the whole page finishes loading, hovering on a post or a picture would show a couple of buttons, including a like button(the heart shape one on the bottom left corner).
Can anybody explain how it works? I've been trying to figure it out for a while now, trying the script on the source code, but to no avail.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我就此写了一个 Tumblr 教程:http://like-button.tumblr.com
保存点赞对于服务器,您可以使用以下 URL 并将其设置为不可见
的
src
属性:like
或 <代码>不同于{ReblogURL}
postId 的最后八个字符{PostID}
示例:
将以下代码块剪切并粘贴到紧邻
; 之前的主题中代码>.这将为您在每个帖子上提供一个“赞”按钮,看起来像默认的 Tumblr 灰色心形。当您将鼠标悬停在其上并单击它时,它会变成红色。如果你再次点击它,它会再次变成灰色并删除点赞。
然后将以下按钮代码剪切并粘贴到主题中您想要放置点赞按钮的位置(这必须位于您的
{block:Posts}
块内)。代码:
I wrote a Tumblr tutorial on this: http://like-button.tumblr.com
To save a Like to the server, you use the following URL and set it as the
src
attribute of an invisible<iframe>
:like
orunlike
{ReblogURL}
{PostID}
Example:
Cut and paste the following code block into your theme immediately before
</head>
. This will give you a like button on each post that looks like the default Tumblr grey heart. It will turn red when you hover over it and when you click it. If you click it again, it will turn grey again and delete the Like.Then cut and paste the following button code into your theme where you want your like button to be (this must be inside your
{block:Posts}
block).Code:
这是我在源代码中发现的,这意味着带有“点赞”按钮和“转发”按钮链接的 div 只是硬编码并用 css 隐藏。正如您所看到的,当您将鼠标悬停在该元素上时,会有一个 css 块。所以这只是CSS。
编辑:
我添加了一篇文章的 HTML 代码,正如您所看到的,有几个带有类永久链接
CSS 代码
的 div一篇文章的 HTML 代码:
This is what i found in the sourcecode, it means that the div's with the links of the like button and the reblog button are just hard coded and hidden with css. As you can see there is a css block for when you hover over the element. So it's just CSS.
EDIT:
I added the HTML code of a post, as you can see there are a couple of div's with class permalink
CSS code
HTML code of one post: