Newer
Older
dmpopidor / lib / assets / javascripts / utils / tabHelper.js
@bhavi bhavi on 26 Oct 2017 393 bytes Added Feedback Request to Org Details
/* eslint-env browser */ // This allows us to reference 'window' below

$(() => {
  // If the URL contains a tab reference then show that tab
  const loc = window.location.hash;
  if (loc) {
    $(`ul.nav a[href="${loc}"]`).tab('show');
  }

  $('.nav-tabs').click((e) => {
    $(e.target).tab('show');
    window.location.hash = $(e.target).attr('href');
    window.scrollTo(0, 0);
  });
});