当显示多个类似按钮(大约 60 个按钮)时,如何减少加载时间?

发布于 2024-12-04 10:17:16 字数 373 浏览 0 评论 0原文

在我的一个页面上,我展示了大约 60 件我希望通过 Facebook 获得“喜爱”的商品。问题是我无法使用多个页面来显示项目,因为这会降低页面的可用性。但是,当加载/显示 60 个类似按钮时,对于我的浏览器来说实在太多了。该页面不再可用,因为由于显示 60 个喜欢的按钮的影响,即使滚动也需要几秒钟。

有人知道使用“喜欢”按钮的替代方法吗?是否可以构建一个自定义的点赞按钮,从我的本地数据库加载点赞计数,并在用户单击我自己的点赞按钮时以某种方式触发 facebook 点赞机制? 这可以通过构建一个自定义的“喜欢”按钮来完成,该按钮在单击时加载真正的“喜欢”按钮,隐藏它并自动触发单击真正的“喜欢”按钮? Facebook 指南会允许还是禁止这种行为?如果是这样的话,还有其他办法吗?

此致, 丹尼尔

On one of my pages I'm showing about 60 items I would like to be "likeable" via facebook. The problem is that I can not use several pages to show the items since this would reduce the usability of the page. But when loading / showing 60 like buttons is just too much for my browser. The page is not usable anymore because even scrolling takes several seconds because of the impact of showing 60 likte buttons.

Does anybody know of an alternative way of using the like button? Would it be possible to build a custom like button which loads the like count from my local database and somehow triggers the facebook like mechanism when the user clicks on my own like button?
This could be done by building a custom like button which on click loads the real like button, hides it and automatically triggers the click on the real like button? Would this even be allowed or is forbidden by the facebook guidelines? If that is the case, is there any other way?

Best regards,
Daniel

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

笛声青案梦长安 2024-12-11 10:17:16

使用占位符图像,并在用户将鼠标悬停在其上时通过 javascript 延迟加载它们。 Techcrunch 就是这么做的。

Use a placeholder image and load them lazily via javascript when the user hovers on it. That's what Techcrunch does.

秋日私语 2024-12-11 10:17:16

您可以在此处执行一些操作来加快加载时间:

  • 确保仅加载 JS SDK 一次 - 来自 点赞按钮配置器 会为您处理这个问题。
  • 异步加载 JS SDK,如 JS SDK 概述页面 上所述
  • 使用 XFBML 版本点赞按钮的

There are a few things you can do here that may speed up load times:

  • Make sure you're only loading the JS SDK once - the latest code from the Like button configurator takes care of this for you.
  • Load the JS SDK asynchronously, as described on the JS SDK overview page
  • Use the XFBML version of the Like button
过度放纵 2024-12-11 10:17:16

您应该使用 xFBML 版本的 Like 按钮并异步加载 SDK。
http://developers.facebook.com/docs/reference/javascript/

You should use xFBML version of Like button and load the SDK asynchronously.
http://developers.facebook.com/docs/reference/javascript/

逆蝶 2024-12-11 10:17:16

您无法在 JavaScript 中触发“点赞”按钮的点击。

但是,您可以隐藏“赞”按钮,直到用户将鼠标悬停在“赞”按钮上并创建它。

像这样的东西可能会有所帮助:

http://www.reddit.com/r /programming/comments/k6kzy/german_publisher_heise_creates_a_privacy/

You cannot trigger the click of a like button in javascript.

You can however, hide the like button until the user hovers over the like button and create it then.

Something like this might be helpful:

http://www.reddit.com/r/programming/comments/k6kzy/german_publisher_heise_creates_a_privacy/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文