JQuery Social Sharer
How do I make an jquery social sharer?
What is a jquery social sharer? How do you make a jquery social sharer? This script and codes were developed by Max on 21 November 2022, Monday.
JQuery Social Sharer - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>jQuery Social Sharer</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.js"></script>
<meta charset=utf-8 />
<title>Social Share</title>
</head>
<body> <h1>Social Buttons with Pop-up</h1> <div id="share"> <a href="#" class="twitter" data-social='{"type":"twitter", "url":"http://code-tricks.com/51-best-jquery-plugins/", "text": "51 Best jQuery Plugins"}' title="code-tricks">Share on Twitter</a> <br> <a href="#" class="facebook" data-social='{"type":"facebook", "url":"http://code-tricks.com/51-best-jquery-plugins/", "text": "51 Best jQuery Plugins"}' title="code-tricks">Share on facebook</a> <br> <a href="#" class="plusone" data-social='{"type":"plusone", "url":"http://code-tricks.com/51-best-jquery-plugins/", "text": "51 Best jQuery Plugins"}' title="code-tricks">Share on Google Plus</a> </div>
</body>
</html> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
JQuery Social Sharer - Script Codes JS Codes
;(function($){ $.fn.jqSocialSharer = function(options){ //settings var settings = $.extend({ "popUpWidth" : 550, "popUpHeight": 450, "popUpTop" : 0, "useCurrentLocation" : false }, options); return this.each(function(index, value){ $(this).click(function(evt){ evt.preventDefault(); var social = $(this).data('social'), width=settings.popUpWidth, /*Set the Pop-up Width*/ height=settings.popUpHeight, /*Set the Pop-up Height*/ sHeight=screen.height, sWidth=screen.width, left=Math.round((sWidth/2)-(width/2)), top=0, url, useCurrentLoc = settings.useCurrentLocation, socialURL = (useCurrentLoc) ? window.location : encodeURIComponent(social.url), socialText = social.text; switch(social.type){ case 'facebook': url = 'https://www.facebook.com/sharer.php?u='+ socialURL + '&t=' + socialText; break; case 'twitter': url = 'https://twitter.com/share?url='+ socialURL + '&text=' + socialText; break; case 'plusone': url = 'https://plusone.google.com/_/+1/confirm?hl=en&url=' + socialURL; break; } /*Finally fire the Pop-up*/ window.open(url,'','left='+left+',top='+top+',width='+width+',height='+height+',personalbar=0,toolbar=0,scrollbars=1,resizable=1'); }); }); };
}(jQuery));
$("#share a").jqSocialSharer();
Developer | Max |
Username | maxds |
Uploaded | November 21, 2022 |
Rating | 3 |
Size | 2,275 Kb |
Views | 16,192 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
JqProgressBar | 2,471 Kb |
GetUrlParameters | 1,713 Kb |
JQuery Simple Li Accordion | 3,595 Kb |
Encode image to Base64 | 16,385 Kb |
Image Magnifier Using jQuery | 2,479 Kb |
Table border-collapse property | 1,672 Kb |
Awesome Blockquote Styling with CSS | 2,706 Kb |
A Pen by Max | 2,412 Kb |
Simple CSS Menu with Multiple Sub Menu | 2,728 Kb |
JQuery Data Filter | 2,439 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
A Pen by Ben Babics | Benbabics | 2,957 Kb |
Multicolumns 2 | Raphaelgoetter | 1,857 Kb |
Alter bg opacity on hover... | Chrisboon27 | 2,054 Kb |
Exploring css spinners | Akagr | 3,569 Kb |
Google Chrome Icon using Pure CSS in one DIV | Grssam | 3,627 Kb |
A Pen by Gregory Potdevin | GregoryPotdevin | 1,713 Kb |
TigerWoods Freecodecamp Page | Baileytj | 2,869 Kb |
Loader | MikitaLisavets | 3,321 Kb |
Pictos font library from CodePen | Jstam | 3,790 Kb |
Sass Get Function | Lukewatts | 2,155 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!