Animating Button Text with JavaScript | Modern Button Hover Effects

Animating Button Text with JavaScript | Modern Button Hover Effects



All Source Code : https://www.patreon.com/onlinetutorials Get now more than 1000+ source code just by clicking on this link …

source

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Modern Button Hover Effects</title>
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <a href="#">Hover Me</a>
    <a href="#">Click Here</a>
    <a href="#">Awesome</a>
    <script>
        document.querySelectorAll('a').forEach(link => {
            link.innerHTML = link.innerText.split('').map((letters,i) => {
                if (letters === ' '){
                    return ' ';
                } else {
                    return `<span style="transition-delay:${i * 50}ms">${letters}</span>`
                }
            }).join('');
        })
    </script>
</body>
</html>
@import url('https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap');
*
{
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	font-family: 'Poppins', sans-serif;
}
body 
{
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	flex-direction: column;
	gap: 40px;
	background: #333;
}
a 
{
	color: #fff;
	text-decoration: none;
	font-size: 1.25em;
	letter-spacing: 0.1em;
	border: 1px solid #fff;
	padding: 10px 30px;
	border-radius: 30px;
	display: inline-block;
	text-transform: uppercase;
	transition: 0.5s;
	overflow: hidden;
}
a:hover 
{
	background: #fff;
}
a span 
{
	display: inline-flex;
	transition: 0.4s;
	text-shadow: 0 50px #333;
}
a:hover span 
{
	transform: translateY(-50px);
}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *