title: Base an if statement on the href of a clicked link
body: <p>I am new to stackoverflow and have a question regarding the following code:</p>
  
  <p>JavaScript:</p>
  
  <pre><code>$(window).load(function() {
      "use strict";
  
      setTimeout(function() {
          $('#preloader').velocity({
  
              opacity: "0",
  
              complete: function() {
                  $("#loading").velocity("fadeOut", {
                      duration: 1000,
                      easing: [0.7, 0, 0.3, 1],
                  });
                  $('body').addClass('loaded');   
                  setTimeout(function() {
                     //Init waterpipe
                       var smokyBG = $('#canvas').waterpipe();
                  }, 1000);
              }
          });
      }, 1000);
      setTimeout(function() {
          $(".link.left").css("left", "0px");
          $(".link.left1").css("left", "0px");
          $(".link.left2").css("left", "0px");
          $(".link.right").css("right", "0px");
          setTimeout(function() {
              $('.hero-text').each(function(i) {
                  (function(object) {
                      setTimeout(function() {
                          $(object).addClass('fadeInDown').removeClass('opacity-0');
                      }, (i * 300) + 300);
                  })(this);
              });
          }, 1200);
      }, 1000);
  
  
  })
  
  
  $(document).ready(function() {
      "use strict";
  
      /* ------------------------------------- */
      /* 2. Page Reveal Effect ............... */
      /* ------------------------------------- */
      var ifTouchDevices = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|Windows Phone)/);
  
      var revealerOpts = {
          nmbLayers: 3,
          bgcolor: ['#f5f5f5', '#33CCFF', '#323232'],
          effect: 'open-effect',
          onStart: function(direction) {
              if (direction === 'left') $("#about, #team").addClass('animate-' + direction); 
              else if (direction === 'right') $("#contact").addClass('animate-' + direction);
  
  
          },
          onEnd: function(direction) {
              $("#about").removeClass("animate-left");
              $("#team").removeClass("animate-left");
              $("#contact").removeClass("animate-right");
              if (isDesktop()) $(".service-header").addClass("opacity-0");
          }
      };
      var revealer = new Revealer(revealerOpts);
  
      function isDesktop() {
          if ($(window).width() &gt;= 1000) return true;
          else return false;
      }
  
  function reveal(direction) {
    var callbackTime = 750,
      callbackFn = function() {
        if (direction === 'left') {
          setTimeout(function() {
            $("#about").addClass("active");
            setTimeout(function() {
              $("#about").removeClass('in');
              setTimeout(function() {
                scrollbar('.about_content');
              }, 1000);
            }, 1200);
          }, 1000);
        } else if (direction === 'right') {
          setTimeout(function() {
            $("#contact").addClass("active");
            setTimeout(function() {
              $("#contact").removeClass('in');
              setTimeout(function() {
                scrollbar('.contact_content');
              }, 1000);
            }, 1200);
          }, 1000);
  
        }
  
  revealer.reveal(direction, callbackTime, callbackFn);
      }
  
      /* ------------------------------------- */
      /* 3. Action Buttons ................... */
      /* ------------------------------------- */
  
      $('.link a').on( "click", function() {
  
          if (!isDesktop()) return;
          $("section.active").removeClass("active");
          $("#about").removeClass("active");
          $("#contact").removeClass("active");
          $("#team").removeClass("active");
          if (!$("#about").hasClass("in")) {
              $("#about").addClass("in");
          }
          if (!$("#contact").hasClass("in")) {
              $("#contact").addClass("in");
          }
          if (!$("#team").hasClass("in")) {
              $("#team").addClass("in");
          }
  
          var target = $(this).attr('href');
          reveal($(target).attr('data-direction'));
          return false;
      });
      /* Close Button */
      $('.btn-close').on( "click", function() {
          closeContent($(this).attr('href'));
          return false;
      });
  
      function closeContent(_target) {
          $(_target).addClass('out');
          setTimeout((function() {
              $(_target).removeClass('active out');
              $(_target).addClass('in');
              $('.hero-text').addClass('opacity-0');
              $('.hero-text').removeClass('fadeInDown');
              $("#body-container").addClass('active');
          }), 2200);
          setTimeout(function() {
              $('.hero-text').each(function(i) {
                  (function(self) {
                      setTimeout(function() {
                          $(self).addClass('fadeInDown').removeClass('opacity-0');
                      }, (i * 300) + 300);
                  })(this);
              });
          }, 3000);
      }
  
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="link left"&gt;
    &lt;div class="link-box"&gt; &lt;a class="link-box-left" href="#about" title="About Us"&gt;
        &lt;p class="lmenu"&gt;ABOUT US&lt;/p&gt;
      &lt;/a&gt;
      &lt;div class="lmenu-line-box"&gt;
        &lt;div class="lmenu-line-mask"&gt;
          &lt;div class="lmenu-line"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt; &lt;a class="link-background left" href="#"&gt;&lt;/a&gt; The section HTML: &lt;section id="about" class="page-inner" data-direction="left"&gt;
  </code></pre>
  
  <p>On the website, the internal links are working with animations and the href does not become part of the url.</p>
  
  <p>Until now, there were only two links on the page (left side and right side) but now I want to have several links on the left side, which is why I would like to change the if condition from "direction" to the href of the clicked link. Is there any way I can do that? </p>
  
  <p>Thank you very much in advance!</p>