Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery - click event to add and remove active class

0 votes
66 views
added Apr 17 in jQuery by LC Marshal Captain (23,680 points)
$('.floating-menu').click(function () {
    $('.floating-menu').removeClass('active');
    $(this).addClass('active');  // use this to add class instead
});

 

CSS

.floating-menu {
  text-align: center;
  padding: 12px;
  border-bottom: 1px dotted #000;
  font-size: 1.2rem;
  &:hover, &.active {
    background: $award19-color;
  }
}

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...