Developer-Josh
5/26/2017 - 9:45 PM

Re-position scrollable element to child element position based on the off-set of that child element to its parent.

Re-position scrollable element to child element position based on the off-set of that child element to its parent.

//Determine position of active tab and scroll mobile nav to that position and highlight
function autoScrollNav(nav) {
    $(document).ready(function (e) {
      var $pageElement = $(nav),
          $scrollElement = $(".account-nav-inner"),
          offset = $pageElement.offset().left - 15;
      $pageElement.addClass("active-nav");
      $scrollElement.animate({scrollLeft: offset}, "fast");
    });
}