Skip to content

Instantly share code, notes, and snippets.

@makschernetskyi
Created April 25, 2025 15:22
Show Gist options
  • Save makschernetskyi/9ce7e0ea66d3bc44feb84f31919d3109 to your computer and use it in GitHub Desktop.
Save makschernetskyi/9ce7e0ea66d3bc44feb84f31919d3109 to your computer and use it in GitHub Desktop.
whatsapp button
window.onload = () => {
const body = document.getElementsByTagName('body')[0]
const button = document.createElement('a')
Object.assign(button.style, {
backgroundColor: '#FFFFFF',
borderRadius: "100%",
position: "fixed",
right: "1rem",
bottom: "1rem",
height: "4rem",
width: "4rem",
boxShadow: "0px 2px 10px -2px rgba(0,0,0,0.5)",
display: "flex",
justifyContent: "center",
alignItems: "center",
padding: "0.2rem",
boxSizing: "border-box"
});
button.href = "https://wa.me/436787900157"
button.target="_blank"
const whatsappLogo = document.createElement('img')
whatsappLogo.src = "https://gist.githubusercontent.com/makschernetskyi/efe31b5404d50af57b58b887d6243c8d/raw/a2f201ef1b73eb4cde02d7236452cecdbedab2df/gistfile1.svg"
Object.assign(whatsappLogo.style, {
height: "100%",
width: "100%"
});
button.appendChild(whatsappLogo)
body.appendChild(button)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment