function shareQuote(socialMedia){ const quote = quoteElem.textContent; const author = authorElem.textContent; const tweetUrl = `http://${socialMedia}.com/intent/tweet?text=${quote}-${author}`; window.open(tweetUrl , '_blank'); } facebookBtn.addEventListener('click', shareQuote.bind(this,"facebook")) tweetBtn.addEventListener('click' , shareQuote.bind(this,"twitter") );
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter