title: Smooth scroll anchor link requires unwanted double click
body: <p>Hey I'm trying to fix a tab inspired page for mobile. When the user clicks on a round circle it should ge to the text. Than when you click "Terug naar keuzemenu" you should go back to the circles (the navigation of the tabs). However when I want to go to other tabs the first time I click he doesnt scroll to the text section but the second time he does. So i have to click twice but cant figure out why.</p>
  
  <p>FIDDLE</p>
  
  <p><a href="https://jsfiddle.net/Ljv5a2ez/2/" rel="nofollow">https://jsfiddle.net/Ljv5a2ez/2/</a></p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div class="span12" id="xx-content"&gt;
          &lt;div class="clearfix row-fluid"&gt;
              &lt;div class="xx_content_inner"&gt;
                  &lt;div class="xx_row-12" id="aj_logobox"&gt;
                      &lt;div class="span3"&gt;
                          &lt;div class="xx_active check-up-overview" id="lente"&gt;
                              &lt;div class="xx_logo_container"&gt;
                                  &lt;div class="xx_logo_inner"&gt;
                                  &lt;a href="#hometext"&gt;
                                  &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/home_delivery.jpg" /&gt;
                                  &lt;/a&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="span3"&gt;
                          &lt;div class="check-up-overview" id="full"&gt;
                              &lt;div class="xx_logo_container"&gt;
                                  &lt;div class="xx_logo_inner"&gt;
                                  &lt;a href="#collecttext"&gt;
                                  &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/click_and_collect.jpg" /&gt;
                                  &lt;/a&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="span3"&gt;
                          &lt;div class="check-up-overview" id="pro"&gt;
                              &lt;div class="xx_logo_container"&gt;
                                  &lt;div class="xx_logo_inner"&gt;
                                  &lt;a href="#moretext"&gt;
                                  &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/look_for_more.jpg" /&gt;
                                      &lt;/a&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="span3"&gt;
                          &lt;div class="check-up-overview" id="ebike"&gt;
                              &lt;div class="xx_logo_container"&gt;
                                  &lt;div class="xx_logo_inner"&gt;
                                  &lt;a href="#smarttext"&gt;
                                  &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/smartpay_cirkel.jpg" /&gt;
                                  &lt;/a&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="xx_row-2 lente bike-show" id="hometext"&gt;
  
                      &lt;p&gt;&lt;span class="xx_title" id="title"&gt;&lt;h2 class="aj_h2fix"&gt;Gratis thuis leveren vanuit je A.S.Adventure Store&lt;/h2&gt;&lt;/span&gt;&lt;/p&gt;
                      &lt;p class="xx_excl"&gt;Sta je in de winkel en is het product van je dromen niet meer beschikbaar in een andere maat of kleur?&lt;br&gt; Geen nood: indien voorradig in een andere A.S.Adventure Store, &lt;strong&gt;bestellen&lt;/strong&gt; we het gewenste product in de Store en &lt;strong&gt;leveren&lt;/strong&gt; we het &lt;strong&gt;gratis&lt;/strong&gt;&lt;br&gt; op een &lt;strong&gt;adres naar keuze&lt;/strong&gt;. Van service gesproken.&lt;/p&gt;
  
                  &lt;/div&gt;
                  &lt;div class="xx_row-2 full bike-hide" id="collecttext"&gt;
                      &lt;p&gt;&lt;span class="xx_title" id="title"&gt;&lt;h2 class="aj_h2fix"&gt;Maak je keuze online en haal je bestelling op in de winkel&lt;/h2&gt;&lt;/span&gt;&lt;/p&gt;
                      &lt;p class="xx_excl"&gt;Vanuit je luie zetel shoppen? Winkelen bij A.S.Adventure kun je altijd en overal. Wil je helemaal zeker zijn van de maat of kleur?&lt;br&gt; &lt;strong&gt;Reserveer online zonder aankoopverplichting&lt;/strong&gt; via de Click &amp;amp; Collect service en haal je bestelling later op in jouw&lt;br&gt; &lt;strong&gt;favoriete A.S.Adventure Store&lt;/strong&gt;. Je kiest zelf wat je wel of niet koopt.&lt;/p&gt;
                  &lt;/div&gt;          
                  &lt;div class="xx_row-2 pro bike-hide" id="moretext"&gt;
                      &lt;p&gt;&lt;span class="xx_title" id="title"&gt;&lt;h2 class="aj_h2fix"&gt;Ontdek een nog uitgebreider aanbod in onze webshop&lt;/h2&gt;&lt;/span&gt;&lt;/p&gt;
                      &lt;p class="xx_excl"&gt;Dacht je dat je alles al gezien had in onze Stores? Think again! In &lt;strong&gt;onze webshop vind&lt;/strong&gt; je van de onderstaande merken een &lt;strong&gt;nog uitgebreider aanbod&lt;/strong&gt;. &lt;br&gt;Gebruik de schermen in de Stores om naar de webshop te surfen of grasduin online door ons aanbod.&lt;br&gt; Keuze gemaakt? Laat je producten dan &lt;strong&gt;gratis afleveren&lt;/strong&gt; via Home Delivery.&lt;/p&gt;
                  &lt;/div&gt;
                  &lt;div class="xx_row-2 ebike bike-hide" id="smarttext"&gt;
                      &lt;p&gt;&lt;span class="xx_title" id="title"&gt;&lt;h2 class="aj_h2fix"&gt;Betaal je aankopen in de winkel met je smartphone&lt;/h2&gt;&lt;/span&gt;&lt;/p&gt;
                      &lt;p class="xx_excl"&gt;Merk je tijdens het winkelen dat je je portefeuille bent vergeten? Geen nood, vanaf nu kun je &lt;strong&gt;in alle A.S.Adventure Stores ook betalen met SmartPay&lt;/strong&gt;. &lt;br&gt;Even je &lt;strong&gt;smartphone&lt;/strong&gt; opdiepen, de &lt;strong&gt;Bancontact-app&lt;/strong&gt; openen en de &lt;strong&gt;unieke QR-code&lt;/strong&gt; aan de kassa inscannen. &lt;br&gt;Je hoeft dan alleen nog even de betaling te bevestigen met je pincode. Makkelijk, veilig en effici&amp;euml;nt!&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="clearfix row-fluid lente bike-show"&gt;
              &lt;div class="xx_row-3"&gt;
                  &lt;div class="span12"&gt;
                      &lt;div class="xx_span_inner xx_top"&gt;
                          &lt;h3&gt;Hoe werkt het?&lt;/h3&gt;
  
                          &lt;ul style="list-style:none;"&gt;
                              &lt;li&gt;&lt;span&gt;1.&lt;/span&gt; We bestellen samen in de Store met jou het gewenste artikel via onze website.&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;2.&lt;/span&gt; Je betaalt aan de kassa.&lt;/li&gt;
                          &lt;li class="xx_last-item"&gt;&lt;span&gt;3.&lt;/span&gt; Je bestelling wordt enkele dagen later geleverd op een adres naar keuze of bij een afhaalpunt.&lt;/li&gt;
                          &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;a href="#lente"&gt;Terug naar keuzemenu&lt;/a&gt;
      &lt;/div&gt;
  
      &lt;div class="clearfix row-fluid full bike-hide"&gt;
          &lt;div class="xx_row-3"&gt;
              &lt;div class="span12"&gt;
                  &lt;div class="xx_span_inner xx_top"&gt;
                      &lt;h3&gt;Hoe werkt het?&lt;/h3&gt;
  
                      &lt;ul style="list-style:none;"&gt;
                          &lt;li&gt;&lt;span&gt;1.&lt;/span&gt; Reserveer en betaal je product(en) online.&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;2.&lt;/span&gt; Kies de winkel waar je je product(en) wenst af te halen.&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;3.&lt;/span&gt; Je ontvangt via mail een bevestiging van je bestelling.&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;4.&lt;/span&gt; Via mail of sms verneem je wanneer je product(en) klaarliggen.&lt;/li&gt;
                          &lt;li class="xx_last-item"&gt;&lt;span&gt;5.&lt;/span&gt; Mocht je in de winkel alsnog beslissen je aankoop te annuleren, krijg je onmiddellijk je geld terug.&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;a href="#lente"&gt;Terug naar keuzemenu&lt;/a&gt;
      &lt;/div&gt;
  
      &lt;div class="clearfix row-fluid pro bike-hide"&gt;
          &lt;div class="xx_row-3"&gt;
              &lt;div class="span12"&gt;
                  &lt;div class="xx_span_inner xx_top"&gt;
                      &lt;h3&gt;Uitgebreid aanbod:&lt;/h3&gt;
  
                      &lt;div id="xx_aanbod_logos"&gt;
                          &lt;a alt="Fjallraven" href="http://www.asadventure.com/benl/fjallraven" target="_parent"&gt;&lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_fjallraven.png" /&gt; &lt;/a&gt;
                          &lt;a alt="The North Face" href="http://www.asadventure.com/benl/the-north-face" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_the-north-face.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Vaude" href="http://www.asadventure.com/benl/vaude" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_vaude.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Garmin" href="http://www.asadventure.com/benl/garmin" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_garmin.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Thule" href="http://www.asadventure.com/benl/thule" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_thule.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Eastpak" href="http://www.asadventure.com/benl/eastpak" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_eastpak.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Millet" href="http://www.asadventure.com/benl/millet" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_millet.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Gore Bike wear" href="http://www.asadventure.com/benl/gore-bike-wear" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_gore_bike.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Gore Running wear" href="http://www.asadventure.com/benl/gore-running-wear" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_gore_running.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Mi-Pac" href="http://www.asadventure.com/benl/mi-pac" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_mi-pac.png" /&gt; &lt;/a&gt;
                          &lt;br&gt;
                          &lt;a alt="Suunto" href="http://www.asadventure.com/benl/suunto" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_suunto.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Polar" href="http://www.asadventure.com/benl/polar" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_polar.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Camel Active" href="http://www.asadventure.com/benl/camel-active" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_camel_active.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Dakine" href="http://www.asadventure.com/benl/dakine" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_dakine.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Lowa" href="http://www.asadventure.com/benl/lowa" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_lowa.png" /&gt; &lt;/a&gt;
                          &lt;a alt="CKS" href="http://www.asadventure.com/benl/cks-dames" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_cks_black.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Komono" href="http://www.asadventure.com/benl/komono" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_komono.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Jack Wolfskin" href="http://www.asadventure.com/benl/jack-wolfskin" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_wolfskin.png" /&gt; &lt;/a&gt;
                          &lt;a alt="BakerBridge" href="http://www.asadventure.com/benl/baker-bridge" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_baker-bridge.png" /&gt; &lt;/a&gt;
                          &lt;a alt="BakerBridge Dames" href="http://www.asadventure.com/benl/baker-bridge-dames" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_baker-bridge-dames.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Bergans" href="http://www.asadventure.com/benl/bergans" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_bergans.png" /&gt; &lt;/a&gt;
                          &lt;a alt="Van Hassels" href="http://www.asadventure.com/benl/van-hassels" target="_parent"&gt; &lt;img src="http://www1.asadventure.com/headoffice/13-ASA-2374/img/logo_van-hassels.png" /&gt; &lt;/a&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;a href="#lente"&gt;Terug naar keuzemenu&lt;/a&gt;
      &lt;/div&gt;
  
      &lt;div class="clearfix row-fluid ebike bike-hide"&gt;
          &lt;div class="xx_row-3"&gt;
              &lt;div class="span12"&gt;
                  &lt;div class="xx_span_inner xx_top"&gt;
                      &lt;h3&gt;Hoe werkt het?&lt;/h3&gt;
  
                      &lt;ul style="list-style:none;"&gt;
                          &lt;li&gt;&lt;span&gt;1.&lt;/span&gt; Installeer de Bancontact-app op je smartphone:&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;a target="_blank" href="https://play.google.com/store/apps/details?id=mobi.inthepocket.bcmc.bancontact&amp;hl=en"&gt;Google Play &gt;&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;a target="_blank" href="https://itunes.apple.com/be/app/bancontact-mobile/id858371800?l=en&amp;mt=8"&gt;Apple App Store &gt;&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;a target="_blank" href="https://www.microsoft.com/en-gb/store/apps/bancontact/9nblggh3fvl1"&gt;Microsoft Store &gt;&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;2.&lt;/span&gt; Open de Bancontact&amp;#45;app en volg de instructies om de app te activeren en je bankkaart(en) toe te voegen.&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;3.&lt;/span&gt; Aan de kassa scan je de unieke QR&amp;#45;code die op de betaalterminal verschijnt om je betaling te bevestigen.&lt;br&gt; Dat kan gewoon vanuit de Bancontact&amp;#45;app.&lt;/li&gt;
                          &lt;li&gt;&lt;span&gt;4.&lt;/span&gt; Je smartphone toont de naam van de winkel en het te betalen bedrag op het scherm.&lt;/li&gt;
                          &lt;li class="xx_last-item"&gt;&lt;span&gt;5.&lt;/span&gt; Druk op OK, geef je pincode op in de app en je krijgt een bevestigingsbericht te zien op je telefoon. Transactie geslaagd!&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
  
          &lt;/div&gt;
          &lt;a href="#lente"&gt;Terug naar keuzemenu&lt;/a&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>JS TABS</p>
  
  <pre><code>$(document).ready(function () {
      $('.check-up-overview').click(function () {
          if (!$(this).hasClass('xx_active')) {
              var sCurrent = $(this).attr('id');
              var sPrevious = $('.xx_active').attr('id');
              $('.xx_active').removeClass('xx_active');
              $('.' + sPrevious).removeClass('bike-show').addClass('bike-hide');
              $(this).addClass('xx_active');
              $('.' + sCurrent).removeClass('bike-hide').addClass('bike-show');
          }
      });
  });
  </code></pre>
  
  <p>JS SMOOTH</p>
  
  <pre><code>$(document).ready(function(){
      $('a[href^="#"]').on('click',function (e) {
          e.preventDefault();
          var target = this.hash;
          $target = $(target);
          $('html, body').stop().animate({
              'scrollTop':  $target.offset().top //no need of parseInt here
          }, 900, 'swing', function () {
              window.location.hash = target;
          });
      });
  });
  </code></pre>