我如何才能在 Facebook 上显示“喜欢”鼠标悬停在图像上时链接?
如何在图像上显示 Facebook“点赞”链接?我希望 Facebook 的“点赞”按钮仅在鼠标悬停在图像上时加载。
我想到了一些事情,比如当鼠标悬停在图像上时在图像上附加 iframe,因为如果页面上有很多图像,这样可以防止速度变慢。
我怎样才能用/不用 jQuery 来做这样的事情?
How can I show the Facebook "like" link on an image? I would like the Facebook "like" button to only load when a mouse is over the image.
I had something in mind like appending the iframe on the image as the mouse is over the image as that would prevent slow down if there are many images on the page.
How can I do something like this with/without jQuery?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你不能简单地将这个按钮加载到div中并在鼠标悬停时隐藏img/显示div并在鼠标移开时显示img/隐藏div吗?
Can't you simple load this like button into div and hide img/show div on mouseover and show img/hide div on mouseout ?
正常加载 Facebook 脚本,但尚不包含任何按钮代码。然后,在鼠标悬停时,为 Facebook 按钮编写 div 标签,并通过调用初始化按钮:
这将搜索整个 DOM 并初始化每个按钮。
或者,要仅评估文档的一部分,您可以传入单个元素。
Load the Facebook script as normal, but don't include any button code yet. Then, onmousover, write your div tags for the Facebook button, and initialize the button by calling:
That will search the entire DOM and initialize every button.
Alternatively, to only evaluate only a portion of a document, you can pass in a single element.