• Hosting Hub
  • Our Services
  • Newsroom
  • Explore Us
  • Log in
  • In Twitter
  • Blog Posting Services
  • In LinkedIn
  • Our Code Repository
J
HARAPHULA
OneStop Shop of Information

Updates

  • b2b Email Marketing jobs and ZOHO Campaigns for professionals
    •
  • YouTube Marketing Techniques to minimize Advertising Costs
    •
  • Increase your Video Views with Cutting-Edge YouTube Marketing Services
    •
  • 5 benefits of Online Reputation Management for your Brand
    •
  • How to Design an E-Commerce Website that Converts Visitors into Buyers?
    •
  • Is Whatsapp Marketing effective for Online Learning Platforms?
    •
  • 5 Mobile Marketing Trends to Reach Audience in a Mobile-First World
    •
  • How to Optimize PPC Campaigns for the Education Sector in India?
    •
  • Boost your ROI with Performance Marketing Techniques
    •
  • Your Complete Guide for hiring a Digital Marketing Agency
    •

Script to Add Custom Social Sharing buttons using JQuery?

Blogging Techniques
May 8, 2017
2.6 (34 votes)
Script to Add Custom Social Sharing buttons using JQuery? Script to Add Custom Social Sharing buttons using JQuery?
4 5 97
Our i20 Sidebar Widgets WordPress Plugin

Today Social Media’s are the best ways to bring free real human traffic to your Blog. As you know Google hates artificial backlinks. It is more fruitful for your portal if visitors will start sharing. This practice helps to gain popularity and ranking. Assume you have your blog related to Fashion industry. Every day nearly 200 readers redirects to your blog through Search engines. Here if your portal provides share option, it may 10 readers like your content and share the link in their network. Which will directly helps to bring referral traffic. It was noticed referral traffic helps to generate better Return on Investments.

With this idea recently we introduced Social media Sharing buttons in our blog. My blog is designed using WordPress. While I searched for Social Sharing buttons plugin in WordPress, I got many. But refer to my requirements in my blog I want Custom Social Sharing buttons. I have icon files for Facebook, Twitter and LinkedIn. What more I want is while users will click on these icon files a centered aligned Popup will open. Where my visitors can easily share the link without wasting much of their quality time.

To achieve the same did start with the implementation. Downloaded 3D social media icon images from iconfinder.com. Placed them in side my HTML file using a UL element as below.

Adding Social Sharing icons

<ul class="ulstyle">
<li class="listyle">
<a class="fb-share" target="_blank">
<img src="https://jharaphula.com/wp-content/uploads/2016/05/ico-facebook.png" alt="Facebook" title="Facebook" />
</a>
</li>
<li class="listyle">
<a class="tw-share" target="_blank">
<img src="https://jharaphula.com/wp-content/uploads/2016/05/ico-twitter.png" alt="Twitter" title="Twitter" />
</a>
</li>
<li class="listyle">
<a class="gp-share" target="_blank">
<img src="https://jharaphula.com/wp-content/uploads/2016/05/ico-google_plus.png" alt="Google Plus" title="Google Plus" />
</a>
</li>
<li>
<a class="ln-share" target="_blank">
<img src="https://jharaphula.com/wp-content/uploads/2016/05/ico-linkedin.png" alt="LinkedIn" title="LinkedIn" />
</a>
</li>
</ul>

CSS Styles

.ulstyle {
list-style: outside none none; 
overflow: hidden; 
width: 247px; 
margin: auto;
}
.listyle {
float: left; 
padding-right: 18px;
cursor: pointer;
}
.ln-share {
cursor: pointer;
}

Now what more remain? Yes, to make Social Sharing Functional I have to post parameters like URL or page Title to Social media Sharing APIs. In this scenario I required 4 top Social Medias Facebook, Twitter, Google Plus and LinkedIn. The Social Sharing API’s for these 4 popular Social networking sites are as below.

Facebook – http://www.facebook.com/share.php?u=[URL]&title=[TITLE]
Twitter – http://twitter.com/intent/tweet?status=[TITLE]+[URL]
Google Plus – https://plus.google.com/share?url=[URL]
LinkedIn – http://www.linkedin.com/shareArticle?mini=true&url=[URL]&title=[TITLE]&source=[SOURCE/DOMAIN]

Here to achieve Social Sharing Pop-up’s on click of icon images I did write 4 jquery functions inside document.ready method. These functions are called over the click event of icon images. To open a popup with Social Sharing API’s here I am using the traditional JS window.open method. Using simple calculation aligning these pop-up’s to center. Look at the Script below.

$('.fb-share').click(function(e) {
e.preventDefault();
window.open('https://www.facebook.com/sharer/sharer.php?u=' + location.href + '', 'fbShareWindow', 'height=396, width=630, top=' + (jQuery(window).height() / 2 - 198) + ', left=' + (jQuery(window).width() / 2 - 315) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
return false;
});

$('.tw-share').click(function(e) {
e.preventDefault();
window.open('http://twitter.com/intent/tweet?status=<?php the_title(); ?>' + ' ' + '' + location.href + '', 'twShareWindow', 'height=396, width=630, top=' + (jQuery(window).height() / 2 - 198) + ', left=' + (jQuery(window).width() / 2 - 315) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
return false;
});

$('.gp-share').click(function(e) {
e.preventDefault();
window.open('https://plus.google.com/share?url=' + location.href + '', 'gpShareWindow', 'height=556, width=404, top=' + (jQuery(window).height() / 2 - 278) + ', left=' + (jQuery(window).width() / 2 - 202) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
return false;
});

$('.ln-share').click(function(e) {
e.preventDefault();
window.open('http://www.linkedin.com/shareArticle?mini=true&url=' + location.href + '&title=<?php the_title(); ?>&source=https://jharaphula.com', 'lnShareWindow', 'height=580, width=630, top=' + (jQuery(window).height() / 2 - 290) + ', left=' + (jQuery(window).width() / 2 - 315) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
return false;
});

In the above Script thing to notice is in place of URL I am passing location.href. Which results the current page URL to share.

Tags:Advantages using Jquery, Custom Social Sharing buttons, Sharing buttons using JQuery, Utilize Social Media
6 Crucial WordPress Skills to Manage your Blog
5 Devices to Fix Wi-Fi Deadspots from Netgear Universal and Cisco

Related Posts

  • Jquery Interview Questions and Answers for Experienced and Freshers
  • Free Backlinks Submitter tools to generate 2000+ Bulk Backlinks
  • Why Web2 Guest Posts Backlinks matters for Google Ranking?
  • Basic SEO Interview Questions & Answers for Freshers
  • Paid Guest Posting Service with multi-niche based Old Indian Blog
  • Jquery Mobile Tutorial for Beginners with Examples
  • SEO Agency for Startups - Unlocking Success in the Digital Era
  • How Paid Guest Posting Services Help for SEO Backlinks?
  • Low Price Guest Posting Services with Contextual links boost ROI & SERP
  • How Guest Posting Services useful for SEO Backlinks & Ranking?
  • Google Search Console for SEO Tools for every Webmaster
  • Should I go for paid Guest Posting with No-follow links?

OUR FACILITIES

  • Log in
  • Our Background
  • Policies
  • WordPress.org

CONTACT INFO

  • Reach Us
  • WhatsApp +918260272137

OUR SERVICES

  • Building WordPress Blogs
  • SEO Guest Posting
  • *.fig, *.psd 2 html
  • Video Ads Designing
  • Optimizing Google PageSpeed
  • b2b Gmail IDs

WHY ONESTOP?

We are here to bring high Quality Information. As a multi-niche platform we have spend several years for Collecting various useful Stories. Dream to establish a domain where from you can get all your day today required information. We covers Animals to Zoology.
©2014-2026 JHARAPHULA, ALL RIGHTS RESERVED.