开发者

custom facebook like link?

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....

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.

I found this:

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

But it implements one of their buttons.

EDIT:

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>

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.



I found from another post here:

<a title="send to Facebook" href="http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE&p[summary]=YOUR_SUMMARY&p[url]=YOUR_URL&p[images][0]=YOUR_IMAGE_TO_SHARE_OBJECT" target="_blank"><span><img width="14" height="14" src="'icons/fb.gif" alt="Facebook" /> Facebook></a>

I used this and works well:)


Customizing the Like button is against Facebook's policies.

"While you may scale the size to suit your needs, you may not modify the Like Button in any other way (such as by changing the design)."


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

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.

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.

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).

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


I found Chaddo's article on Custom Facebook Like Button (BlackHat Button) very effective using CSS to customize the button. You can download the zip source code. It works well, and could use improvement in regards to height.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜