O'Reilly logo

Developing Responsive Web Applications with AJAX and jQuery by Sandeep Kumar Patel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring the Facebook Like and Share buttons

In this section, we will learn how to integrate the Facebook Like button into our product pages. Facebook provides the markup and attributes to create a Like and Share button. The following HTML syntax shows the required markup for these buttons:

<div class="fb-like"
     data-href="${url}"
     data-layout="button_count"
     data-action="like"
     data-show-faces="true"
     data-share="true">
</div>

The attributes used in the markup are explained as follows:

  • data-href: This attribute has the value for the targeted link for the Like button.
  • data-layout: This attribute has the value for the style of the button.
  • data-action: This attribute has the value for the action to be done when a user clicks on the Like button.
  • data-show-faces ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required