Skip to content

Easter egg3 min read

How to add a quote share button in Webflow

Learn how to show a share button when a visitor selects text on your Webflow site.

In this tutorial, Sandro, co-founder of Gemeos Webflow agency, shows you how to display a quote-sharing button when a visitor selects text on your Webflow site.

Example

Select text in this paragraph

"The best website is the one your clients understand instantly. Clarity converts better than creativity. A clean design with a strong message always beats a complex design with a vague message."

Select at least 20 characters to see the button appear

BehaviorTriggerAction
Button appearsSelection > 20 charactersButton positioned near the selection
Mobile sharingWeb Share API availableOpens the native share menu
Desktop sharingWeb Share API unavailableOpens Twitter with the quote prefilled
DisappearsClick elsewhereButton hidden

The script

Standalone, no Webflow element needed. Add it to the Footer code.

(function() {
  var style = document.createElement('style');
  style.textContent =
    '.share-quote-btn { position: fixed; background: #111; color: #fff; padding: 8px 14px;' +
    'border-radius: 100px; font-size: 13px; cursor: pointer; z-index: 9999; display: none;' +
    'align-items: center; gap: 6px; border: none; font-family: inherit; white-space: nowrap;' +
    'box-shadow: 0 4px 12px rgba(0,0,0,0.15); transition: opacity 0.2s; }' +
    '.share-quote-btn:hover { opacity: 0.85; }';
  document.head.appendChild(style);

  var btn = document.createElement('button');
  btn.className = 'share-quote-btn';
  btn.innerHTML = '🔗 Share this quote';
  document.body.appendChild(btn);

  var selectedText = '';

  document.addEventListener('mouseup', function(e) {
    var sel = window.getSelection();
    var text = sel ? sel.toString().trim() : '';
    if (text.length < 20) { btn.style.display = 'none'; return; }

    selectedText = text;
    btn.style.display = 'flex';
    btn.style.top = (e.pageY - 50) + 'px';
    btn.style.left = Math.min(e.pageX - 60, window.innerWidth - 220) + 'px';
  });

  document.addEventListener('mousedown', function(e) {
    if (e.target !== btn) btn.style.display = 'none';
  });

  btn.addEventListener('click', function() {
    var url = window.location.href;
    var twitterUrl = 'https://twitter.com/intent/tweet?text=' +
      encodeURIComponent('"' + selectedText.substring(0, 200) + '"') +
      '&url=' + encodeURIComponent(url);

    if (navigator.share) {
      navigator.share({ title: document.title, text: '"' + selectedText + '"', url: url });
    } else {
      window.open(twitterUrl, '_blank');
    }
    btn.style.display = 'none';
  });
})();

Customize sharing

To share on LinkedIn instead of Twitter, replace the URL:

var linkedinUrl = 'https://www.linkedin.com/sharing/share-offsite/?url=' +
  encodeURIComponent(url) + '&summary=' + encodeURIComponent('"' + selectedText + '"');
window.open(linkedinUrl, '_blank');

Conclusion

Quote sharing turns your readers into content amplifiers. Use cases:

  • Long-form articles with punchy wording
  • Interviews and expert quotes
  • Client testimonial pages

Select text in this paragraph

"The best website is the one your clients understand instantly. Clarity converts better than creativity." Select this quote to make the share button appear just above it.

Published on May 20, 2026

Sandro DA SILVA

Growth Marketer, Webflow expert, and jack-of-all-trades. Sandro handles commercial operations, ensures projects run smoothly, and addresses marketing-related issues (SEO, Tracking, Copywriting, etc).

You're going to working with us, guaranteed

Ready to launch your business?

get a quote

Let’s f*****G GO !!