Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

198
Vistas
jQuery + Bootstrap Navigation Bar - How to highlight the link when visited

Please visit this link.

Try to click "Portfolio" link, it should be highlighted with blue background.

But after clicking outside the navigation bar it will be highlighted with blue.

    //scrolling
$('nav a').on('click', function() {

    var scrollAnchor = $(this).attr('data-scroll'),
        scrollPoint = $('section[data-anchor="' + scrollAnchor + '"]').offset().top;

    $('body,html').animate({
        scrollTop: scrollPoint
    }, 500);

    return false;

});

//change color
$(window).scroll(function() {
    var windscroll = $(window).scrollTop();
    if (windscroll) {
        $('section').each(function(i) {
            if ($(this).position().top <= windscroll) {
                $('nav a.active').removeClass('active');
                $('nav a').eq(i).addClass('active');
            }
        });

    }
}).scroll();
about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Just like hover there is also visited,where you can assign color for the visted links.

a:visited {
    color: blue;
}
about 4 years ago · Santiago Trujillo Denunciar

0

Try this

nav a.active,
nav a.active:hover {
  background-color: blue !important;
}
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda