Book Image

Mastering jQuery UI

By : Vijay Joshi
Book Image

Mastering jQuery UI

By: Vijay Joshi

Overview of this book

Table of Contents (19 chapters)
Mastering jQuery UI
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing sharing buttons


We have four sharing buttons and each of these needs to be configured differently to share. When the user will click an icon, we will open a new window and based on the icon that was clicked, redirect the user to the appropriate page. Write the following code inside the initSharing method that will add the event handler for the click event of sharing links:

$('.shareBox a').on('click', function()
{
  var type = $(this).prop('type');
  dashboard.sharePage(type);
});

Content for the first portlet has the shareBox class assigned to it and it has sharing links inside it. In the above code, we added the click event handler for all the links inside the .shareBox div. The callback method for the event handler first gets the value of type attribute for the clicked link. We then call the sharePage method and pass the value of the type property to it. This method will send users to the relevant social media page.

To implement this method go to the dashboard.js file again...