Anchor Slider and :target Selektor

Anchor Slider and :target Selektor

Hi there!
I got a litlle Problem with the following script of  Cedric Dugas!

Its working quite well but I want to highlight the element I scroll to.
Normally i used the :target Selektor to do this but this is not working.
So I added a class to the element, but after I clicked the second link both elements had the same class.

Thats not what I want! How can I remove the class of the first element or is there any other way to use the :target selektor?


  1. $(document).ready(function() {

    anchor = {
    init : function() {
    $("a.Anker").click(function () {
    elementClick = $(this).attr("href");
    destination = $(elementClick).offset().top;
    $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, destination * 3 + 200);
    return false;

    • Topic Participants

    • type