Share Button with Tooltip ✔ Botón de Compartir Tooltip【CSS】

Share Button with Tooltip with css & javascript |Botón de compartir con tooltip. | Share Button botón compartir.

By Hans Engebretsen

DEMO
HTML

<li class="share">
<a href="#" class="tool-handle footer-nav-link button">Share</a>
<ul class="tooltip">
<li><a href="#" class="facebook-share">Facebook</a></li>
<li><a href="#" class="twitter-share">Twitter</a></li>
<li><a href="#" class="email-share">Email</a></li>
<span class="close-button close">&times</span>
</ul>
</li>

CSS

body{text-align:center;background:#f46b45;background:-webkit-linear-gradient(to left,#eea849,#f46b45);background:linear-gradient(to left,#eea849,#f46b45)}
a{display:inline-block;text-decoration:none;letter-spacing:.1em;text-transform:uppercase;color:#fff}
a.button{transition:all 200ms}
.close,.share .close{width:20px;height:20px;z-index:3;color:#fff;border-radius:50%;background-color:#000;cursor:pointer;font-size:16px;transition:200ms opacity 400ms}
.share{position:relative;text-align:left}
.share .tooltip{position:absolute;top:-195px;left:0;box-shadow:0 8px 13px rgba(0,0,0,.36),0 0 0 1px rgba(0,0,0,.06);background-color:#017ED5;border-bottom:2px solid #00243d;border-radius:3px;opacity:0;visibility:hidden;transition:all 200ms ease-in-out,visibility 0ms;transform-origin:bottom center}
.share .tooltip:after,.share .tooltip:before{content:"";display:block;width:0;height:0;position:absolute;left:30px;bottom:-28px;z-index:3;border:15px solid transparent;border-top-color:#017ED5;right:auto}
.share .tooltip:after{bottom:-31px;z-index:2;border-top-color:#00243d}
.show.share .tooltip{display:block;visibility:visible;transform:rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1);animation:wobble 700ms;opacity:1}
.share .close{text-align:center;position:absolute;top:-10px;left:-10px;box-shadow:1px 1px 1px rgba(0,0,0,.3)}
.share .tooltip{padding:10px 0 15px}
.share li a{font-size:.75em;box-sizing:border-box}
a.button{display:inline-block;text-decoration:none;letter-spacing:.1em;text-transform:uppercase;color:#fff;background-color:#b4b5b7;padding:15px 20px;border-radius:2px;font-weigth:700}
.close{position:absolute;top:-10px;left:-10px;box-shadow:1px 1px 1px rgba(0,0,0,.3);opacity:1}
.share{list-style:none;display:inline-block}
.share.show .footer-nav-link{background-color:rgba(0,36,61,.5)}
.share li{list-style:none;display:block;width:100%}
.share li a{display:block;position:relative;width:100%;padding:15px 25px 15px 50px;color:#fff;text-decoration:none}
.share li a:hover{background-color:rgba(180,181,183,.5)}
@keyframes wobble{0%{transform:scale(0) rotate(-54deg) translatey(40px)}
45%{transform:scale(1.1) rotate(20deg) translatey(0px)}
60%{transform:scale(1) rotate(-15deg) translatey(0px)}
77%{transform:scale(1) rotate(10deg) translatey(0px)}
100%{transform:translatey(0)}}
.share a:after{display:block;position:absolute;left:25px;top:50%;transform:translateY(-50%) translateX(-50%);width:7px;height:15px;background-size:100%;content:'';background-repeat:no-repeat}
.share a.twitter-share:after{width:15px;height:10px}
.share a.email-share:after{width:12px;height:9px}
.twitter-share:after{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEgMjQwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAzNzEgMjQwIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNMzIyLjIgMzUuMmMtMTAuMSA0LjUtMjAuOSA3LjUtMzIuMiA4LjggMTEuNi02LjkgMjAuNS0xNy45IDI0LjctMzEtMTAuOCA2LjQtMjIuOCAxMS4xLTM1LjYgMTMuNi0xMC4yLTEwLjktMjQuOC0xNy43LTQwLjktMTcuN0MyMDcuMSA4LjkgMTgyIDM0IDE4MiA2NWMwIDQuNC41IDguNyAxLjUgMTIuOC00Ni42LTIuMy04Ny45LTI0LjctMTE1LjYtNTguNi00LjggOC4zLTcuNiAxNy45LTcuNiAyOC4yIDAgMTkuNSA5LjkgMzYuNiAyNSA0Ni43LTkuMi0uMy0xNy44LTIuOC0yNS40LTd2LjdjMCAyNy4yIDE5LjMgNDkuOCA0NSA1NS00LjcgMS4zLTkuNyAyLTE0Ljgg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bmQiIHNrZXRjaDp0eXBlPSJNU0FydGJvYXJkR3JvdXAiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNTIuMDAwMDAwLCAtMzY0LjAwMDAwMCkiPg0KICAgICAgICAgICAgPGcgaWQ9IkxlZnRCbG9jayIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTEwLjAwMDAwMCwgOTkuMDAwMDAwKSI+DQogICAgICAgICAgICAgICAgPGcgaWQ9Ik1lbnVMZWZ0IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0Mi4wMDAwMDAsIDE4NS4wMDAwMDApIj4NCiAgICAgICAgICAgICAgICAgICAgPGcgaWQ9Ikljb1NlbnQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAuMDAwMDAwLCA4MC4wMDAwMDApIj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDxtYXNrIGlkPSJtYXNrLTIiIHNrZXRjaDpuYW1lPSJpY29uLWVtYWlsIiBmaWxsPSJ3aGl0ZSI+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4NCiAgICAgICAgICAgICAgICAgICAgICAgIDwvbWFzaz4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx1c2UgaWQ9Imljb24tZW1haWwiIGZpbGw9IiNGRkZGRkYiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPg0KICAgICAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICAgICAgPC9nPg0KICAgICAgICAgICAgPC9nPg0KICAgICAgICA8L2c+DQogICAgPC9nPg0KPC9zdmc+)}

JS

$(document).ready(function(){
  
  //Share Tool Function
  function shareTools() {
  var pageTitle = $(document).attr('title'),
      url = document.URL,
      mailBody = "Check this awesome link out: " + url;
    // Twits
    $('.twitter-share').click(function(e){
      e.preventDefault;
      var text = "Check out " + pageTitle + " on http://heportfolio.com";
       window.open('https://twitter.com/intent/tweet?source=webclient&text=' + text,630,360);
    });
    // Facebooks
    $('.facebook-share').click(function(e){
      e.preventDefault;
      window.open('https://www.facebook.com/sharer.php?u='+url,630,360);
    });
    // Emails 
    $('.email-share').attr('href','mailto:?Subject=' + pageTitle + '&Body=' + mailBody);
 }
 shareTools();
  
 //Tool Tip toggle function
 function tooltip(){
   var  toolHandle = $('.tool-handle'),
        toolMenu = toolHandle.parent(),
        toolClose = toolMenu.find('.close');

        toolHandle.click(function(e){
          e.preventDefault();
          toolMenu.toggleClass('show');
        });
        toolClose.on('click', function(){
          toolMenu.removeClass('show');
        });
  }
  tooltip();
  
  // Start with things clicked
  function clickShare(){
    $(".tool-handle").click();
  }
  setTimeout(function() { clickShare();}, 2000);
});
¿Te gusto el post?
¡Compártelo!

☑ Puede que también te interese:

Social Share Button with CSS and HTML
Social Icons vision 3D HTML y CSS
Social Buttons code