title: Add a class to an Anchor using a specific smoot-scroll library
body: <p>I've recently installed the smooth-scroll library from <a href="https://github.com/cferdinandi/smooth-scroll" rel="nofollow noreferrer">cferdinandi</a> and the smooth-scroll feature works like a charm.</p>
  
  <p>The anchors added to my text using a CMS where looking like this:</p>
  
  <pre><code>&lt;span id="authentication" class="ancre"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>The ID being different each time, regarding what I'm talking about in my text. And it works fine.</p>
  
  <p>My problem is that the smooth-scroll library seems to remove the class when it runs, therefore my class='ancre' does not show when the anchor is called. Class being:</p>
  
  <pre><code>.ancre:target{
      background-color: #131b24;
      color: white;
  }
  </code></pre>
  
  <p>So what I did it that I removed the "target" parameter of my class and added a function to my JS file to add the class after the smooth-scroll is run. It looks like this:</p>
  
  <p>CSS in css/app.css</p>
  
  <pre><code>.ancre{
      background-color: #131b24;
      color: white;
  }
  </code></pre>
  
  <p>JS in js/app.js</p>
  
  <pre><code>after: function () {
      var className = 'ancre';
      document.querySelector('.' + className).classList.remove(className);
      document.getElementById(anchor.id).classList.add(className);
  }
  </code></pre>
  
  <p>But it does not work and I just couldn't figure out why.</p>
  
  <p>You can try it by pressing the buttons "2-step authentication" and/or "Mobile" <a href="http://quentinbeau.com/spip.php?article1" rel="nofollow noreferrer">on this page</a>.</p>
  
  <p>I'm not a coder, more a designer and I would be happy to get some help here.</p>
  
  <p>Thank you all for your help,</p>
  
  <p>Best,
  Kwint</p>