Is it possible to customize the Facebook Like button?

Asked

Viewed 439 times

1

Is it possible, I create a custom facebook like button? I want when I click my custom button (http://i.imgur.com/vJSlVfz.png) exactly the same thing would happen if I clicked on the default facebook like button. If yes, how can I do this?

  • yes, it is possible

2 answers

2

Of course I do. You can for example get two images, with different backgrounds, and when you detect the event click changes the image. I think this will be the easiest approach, however there are other possible.

  • Can you give me an example of how to do this?

  • Of course. ?

  • Yes that’s right, right!

  • Then it can look like this: <html> <head> </head> <body> <script> Function toogleLikeIcon() { var sourceImage=Document.getElementById("like"). getattribute("src"); switch(sourceImage) { case "notLike.png":Document.getElementById("like"). src="like.png";break; default:Document.getElementById("like"). src="notLike.png";break; } } </script> <img id="like" src="notLike.png" onclick="toogleLikeIcon();"> <body> </html>

  • You can make a Jsfiddle?

  • @Tiagop. C I never did. But you know what? I’m gonna try....

Show 2 more comments

1

<html> <head> </head> <body> <script> function toogleLikeIcon() { var sourceImage=document.getElementById("like").getAttribute("src"); switch(sourceImage) { case "notLike.png":document.getElementById("like").src="like.png";break; default:document.getElementById("like").src="notLike.png";break; } } </script> <img id="like" src="notLike.png" onclick="toogleLikeIcon();"> <body> </html>

https://jsfiddle.net/1xo09yhc/

 <script async src="//jsfiddle.net/1xo09yhc/embed/"></script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.