custom facebook like link?

前端 未结 4 915
误落风尘
误落风尘 2021-02-03 23:46

Is it possible to add a custom facebook like icon? I would like it to be part of an

    and I don\'t really want to load another library their SDK or all the
4条回答
  •  梦如初夏
    2021-02-04 00:42

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

提交回复
热议问题