HTML AND JS CODE:
<!DOCTYPE html>
<html>
<head>
<title>page</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" type="text/css" href="1.page.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">
</head>
<body>
<a href="#">LIKE</a>
<script
src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a").click(function(){
$("a").toggleClass("active")
})
})
</script>
</body>
</html>
CSS CODE:
body{
margin: 0;
padding: 0;
background: #262626;
font-family: sans-serif;
}
a{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 200px;
height: 75px;
background: #fff;
border-radius: 75px;
line-height: 75px;
text-align: center;
font-size: 30px;
text-decoration: none;
color: #262626;
transition: .5s;
text-transform: uppercase;
}
a.active{
background: transparent;
color: #fff;
}
a:before{
content: "";
position: absolute;
top: 0;
left: 0;
background: #ff0047;
width: 50%;
height: 100%;
transition: .5s;
z-index: -1;
transform: translateX(-200px) rotate(-325deg);
opacity: 0;
}
a.active:before{
left: 30.5px;
transform: translateX(0px) rotate(35deg);
border-top-left-radius: 75px;
border-bottom-left-radius: 75px;
opacity: 1;
}
a:after{
content: "";
position: absolute;
top: 0;
right: 0;
background: #ff0047;
width: 50%;
height: 100%;
transition: .5s;
z-index: -1;
transform: translateX(200px) rotate(325deg);
opacity: 0;
}
a.active:after{
right: 30.5px;
transform: translateX(0px) rotate(-35deg);
border-top-right-radius: 75px;
border-bottom-right-radius: 75px;
opacity: 1;
}
Leave a comment