本文介绍了自定义facebook喜欢链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以添加自定义的Facebook图标?我希望它成为< ul> 的一部分,我真的不想加载他们的SDK或所有< meta> tags ....

Is it possible to add a custom facebook like icon? I would like it to be part of an <ul> and I don't really want to load another library their SDK or all the <meta> tags....

是否有人实现了类似自定义的按钮?我不需要他们的按钮提供的计数器等,说实话,他们是丑陋的。我一直在寻找最近2个小时没有真正的运气。

Has anyone implemented a custom like button? I don't need the counter etc that their buttons provide, and to be honest, they are ugly. I have been searching around for the last 2 hours with no real luck.

我发现了这个:

<a name="fb_share"></a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
    type="text/javascript">
</script>

但它实现了一个按钮。

编辑:

我已经阅读了他们的API,虽然非常容易使用我不喜欢他们的<$ c生成的按钮$ c>< iframe> 或XFBML代码。我只是想知道是否有办法从这样的东西制作自定义链接:

I have read their API, while very easy to use I don't like the buttons generated from their <iframe> or XFBML code. I am simply looking to find out if there is a way to make a custom link from something like this:

<ul>
   <li><a href="some code here">Facebook</a></li>
</ul>

我在API中遗漏了什么?它总是生成一个带有计数器和图形的巨大按钮,这正是我不想要的。

Am I missing something in their API? it always generates a HUGE button with a counter and their graphics, which is exactly what I don't want.

推荐答案

如果你不是手工制作它,那就是

If you're not hand crafting it, there's the Facebook developer "Like" API documentation

如果他们的API没有公开生成的按钮为您复制的内容,那么可以通过一种方式找出类似的内容按钮实际上正在做(如果它不是超链接,因为它可能是由ajax发布,这可能发生)是找出如何在javascript中处理事件。如果脚本已经优化/缩小,这可能会有问题。

If their API doesn't expose what the generated buttons do for you to copy, one way to find out what the like button is actually doing (if it's not a hyperlink, and since it might be posting by ajax, this could happen) is finding out how the event is handled in javascript. This may be problematic if the script has been optimised/minified.

另一种方法是使用收听请求并检查它以查看其目标和任何表格数据。

Another approach is to find out what HTTP requests it generates, using Fiddler to listen to the request and inspect it to see its target and any form data.

如果您对类似按钮的功能感到满意,但不满足其风格,请使用CSS重新设置它,这可能是更安全的选项,因为任何API更改都可能会破坏任何模仿脚本。

If you're happy with the functionality of the like button, but not its style, restyle it with CSS, this may be the safer option, as any API change may break any mimicked script.

否则,除非您设计自己的图标,否则可以下载免费的,使用拇指向上图标作为图像,并对需要不同图标的任何鼠标悬停/点击事件进行轻微编辑,您可以使用JavaScript处理事件,或(取决于哪个)图书馆你'已经加载了。)

Otherwise, unless you're designing your own icons, you can download the free silk icons, use the thumb up icon as an image, and slightly edit it for any mouse-over/click events that require different icons, and you can handle the events with JavaScript, JQuery or JQuery-UI (depending on which libraries you've already got loaded).

这应该处理UI行为,任何回调服务器的调用都可以用AJAX进行()。

That should deal with the UI behaviour, any calls back to the server could be made with AJAX (JQuery AJAX documentation).

这篇关于自定义facebook喜欢链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 02:56