当显示多个类似按钮(大约 60 个按钮)时,如何减少加载时间?
在我的一个页面上,我展示了大约 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用占位符图像,并在用户将鼠标悬停在其上时通过 javascript 延迟加载它们。 Techcrunch 就是这么做的。
Use a placeholder image and load them lazily via javascript when the user hovers on it. That's what Techcrunch does.
您可以在此处执行一些操作来加快加载时间:
There are a few things you can do here that may speed up load times:
您应该使用 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/
您无法在 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/