(function ($) {
  $(document).ready(function () {
    // Media queries
    var mqExtraSmall = 480;
    var mqSmall = 768;
    var mqMedium = 992;
    var mqLarge = 1200;

    // Smooth scrolling for anchor links
    $('a[href*="#"]:not([href="#"],[data-toggle],[data-slide])').click(function() {
      if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
        var target = $(this.hash);
        target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
        if (target.length) {
          $('html, body').animate({
            scrollTop: target.offset().top
          }, 500);
          return false;
        }
      }
    });

    // Functions
    // ------------------------------------------------------------------

    function checkWindowWidth() {
      var windowsize = $(window).width();
      return windowsize;
    }
  });
})(jQuery);

@@ -228,53 +228,95 @@
 %22#%22%5D
-:not(%5Bhref=%22#%22%5D,%5Bdata-toggle%5D,%5Bdata-slide%5D)')
+')%0A    // Remove links that don't actually link to anything%0A    .not('%5Bhref=%22#%22%5D')%0A    
 .cli
@@ -326,17 +326,23 @@
 function
-(
+ (event
 ) %7B%0A    
@@ -347,16 +347,25 @@
     if (
+%0A        
 location
@@ -384,24 +384,25 @@
 place(/%5E%5C//,
+ 
 '') == this.
@@ -428,14 +428,23 @@
 %5C//,
+ 
 '') &&
+%0A       
  loc
@@ -474,20 +474,70 @@
 hostname
+%0A      
 ) %7B%0A
+        // Figure out element to scroll to%0A
         
@@ -638,16 +638,17 @@
 ice(1) +
+ 
 '%5D');%0A  
@@ -657,28 +657,173 @@
     
-if (target.length) %7B
+// Does a scroll target exist?%0A        if (target.length) %7B%0A          // Only prevent default if animation is actually gonna happen%0A          event.preventDefault();
 %0A   
@@ -915,36 +915,464 @@
  %7D, 
-500);%0A          return false
+1000, function () %7B%0A            // Callback after animation%0A            // Must change focus!%0A            var $target = $(target);%0A            $target.focus();%0A            if ($target.is(%22:focus%22)) %7B // Checking if the target was focused%0A              return false;%0A            %7D else %7B%0A              $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable%0A              $target.focus(); // Set focus again%0A            %7D;%0A          %7D)
 ;%0A  

Update smooth scrolling script with focus added