<div id="app">
<div class="button active"></div>
<div class="button"></div>
<div class="button"></div>
<div class="button"></div>
</div>
<a href="https://www.youtube.com/channel/UC7hSS_eujjZOEQrjsda76gA/videos" target="_blank" id="ytd-url">My YouTube Channel</a>
body
{
height: 100%;
margin: 0;
user-select: none;
tap-highlight-color:transparent;
background-color: #E91E63;
}
#app
{
position: absolute;
top: 50%;
right:0;
left: 0;
width: 180px;
height: 20px;
margin: 0 auto;
transform: translateY(-50%);
overflow: hidden;
z-index:1;
}
.button
{
width: 20px;
height: 20px;
float: left;
margin-right: 20px;
background-color: #fff;
border-radius: 20px;
cursor: pointer;
transition: 0.3s ease width;
}
.button:last-child
{
margin-right: 0;
}
.button.active
{
width: 60px;
cursor: auto;
}
#ytd-url {
display: block;
position: fixed;
right: 0;
bottom: 0;
padding: 10px 14px;
margin: 20px;
color: #fff;
font-family: Arial;
font-size: 14px;
text-decoration: none;
background-color: #2c2c2c;
border-radius: 4px;
box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
z-index: 125;
}
$(function()
{
var button = $('.button');
function switchToNext()
{
var _this = $(this);
if(_this.hasClass('active'))
return false;
else
{
$('.button.active').removeClass('active');
_this.addClass('active');
}
}
button.on('click',switchToNext);
});
This Pen doesn't use any external CSS resources.