I have been working on some toggle based buttons. I have two buttons one is buy and other is the demo. I have managed to write a bit of jQuery code for the toggle. everything is working fine except when I click on single button both of them are being toggled. But I want only one of it to be toggled. One other minor thing is when I click on the button some weird animation is being played I guess that is because I have used the toggle. Here is the Fiddle
$(document).ready(function($) {
$('.theme-options').find('#buy').click(function() {
$('.buy span').toggle(200);
});
$('.theme-options').find('#demo').click(function() {
$('.demo span').toggle(200);
});
});
body { position: relative; }
.theme-options {
position: fixed;
right: 0;
top: 40px;
display: flex;
flex-direction: column;
cursor: pointer;
}
.theme-options span {
display: flex;
align-items: center;
}
.buy,
.demo {
padding: 20px 10px;
display: block;
}
.buy span,
.demo span {
display: none;
}
a {
text-decoration: none;
color: #000;
text-transform: uppercase;
}
<div class="theme-options">
<span id="buy">User
<a href="#" class="buy theme">
<span>Want to buy this theme</span>
</a>
</span>
<span id="demo">User
<a href="#" class="demo theme">
<span>Want to request a demo</span>
</a>
</span>
</div>