Add

Lorem ipsum

Lorem ipsum

A
A
A
Easter egg

3 views

3 min

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');

good to know

The Web Share API is available on mobile (iOS Safari, Android Chrome) and on some newer desktop browsers. On browsers that don't support it, the Twitter fallback kicks in automatically. To check support: if (navigator.share) { /* API available */ } else { /* fallback */ }.

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.

Good to know

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Lorem ipsum dolor sit amet consectetur.

Lorem ipsum dolor sit amet consectetur. Aliquam orci sagittis dignissim sapien praesent donec.

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Published on

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

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

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...