JSFiddle - React, Tailwind, and code Playground
by arun_etech
HTML
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<h3>services we offer : when clicked on technology, right content will change and on technology text background color ( white ) will have animation from left to right</h3>
<div class="container">
<div class="service"><span>UIUX</span></div>
<div class="service"><span>E COMMERCE</span></div>
<div class="service active"><span>MOBILE APPS</span></div>
<div class="service"><span>CLOUD DEVELOPMENT</span></div>
<div class="service"><span>BLOCK CHAIN</span></div>
</div>
</body>
</html>
CSS
body {
background-color: red;
}
.container {
position: relative;
width: 420px;
background-color: #2E8DEF;
padding-top: 10px;
padding-bottom: 10px;
}
.container:after{
content: " ";
position: absolute;
display: block;
width: 56px;
height: 100%;
top: 0;
left: 364px;
z-index: -1;
background: #2E8DEF;
border-right: 0px solid #2E8DEF;
transform-origin: bottom left;
-ms-transform: skew(-10deg, 0deg);
-webkit-transform: skew(-10deg, 0deg);
transform: skew(-10deg, 0deg);
}
.container .service {
width: 410px;
display: block;
position: relative;
color: white;
font-size: 30px;
font-weight: 700;
margin-top: 10px;
margin-bottom: 10px;
padding: 6px;
background-image: linear-gradient(to left,
transparent,
transparent 50%,
#fff 50%,
#fff);
background-position: 100% 0;
background-size: 200% 100%;
transition: all .50s ease-in;
}
.container .service:nth-child(1):hover:after, .container .active.service:nth-child(1):after{
width: 53px;
}
.container .service:nth-child(2):hover:after, .container .active.service:nth-child(2):after{
width: 43px;
}
.container .service:nth-child(3):hover:after, .container .active.service:nth-child(3):after {
width: 34px;
height: 46px;
}
.container .service:nth-child(4):hover:after, .container .active.service:nth-child(4):after {
width: 23.5px;
}
.container .service:hover:after, .container .active.service:after {
content: " ";
position: absolute;
display: block;
width: 13.5px;
height: 100%;
top: 0;
left: 410px;
z-index: 0;
animation: edge-service 0s linear .5s;
animation-fill-mode: forwards;
background: transparent;
border-right: 0px solid #fff;
transform-origin: bottom...
JavaScript
$(document).ready(function(){
$('.container').find('.service').click(function(){
$('.container').find('.service').removeClass("active");
$(this).addClass("active");
})
})