Sha256: d0bea50bc28391808e863eb6651429b65d342f9f01717ca6d4536340f088fe21

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

jQuery(document).ready(function(){
  // Javascript to enable link to tab
  var url = document.location.toString();
  if (url.match('#')) {
      $('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
  }

  // If this snippet is activated it will go down to the clicked tab and,
  // on a page refresh... it will remember the active tab.
  //
  // $('.nav-tabs a').on('shown.bs.tab', function (e) {
  //     window.location.hash = e.target.hash;
  // })

  // TODO: This snippet is to fix the offset of the header-wrapper when scrolling to an active tab,
  // but it is based on a landing page (one page website), we need to fix this and make it functional for a nab-tab page
  //
  // $('a[href*=#]:not([href=#])').click(function() {
  //   if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
  //       || location.hostname == this.hostname) {
  //
  //     var target = $(this.hash),
  //     headerHeight = $(".header-wrapper").height() + 5; // Get fixed header height
  //     target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  //
  //     if (target.length) {
  //       console.log(target.offset().top - headerHeight);
  //       $('html,body').animate({
  //         scrollTop: target.offset().top - headerHeight
  //       }, 500);
  //       return false;
  //     }
  //   }
  // });

});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jekyll-theme-marketing-0.5.0 assets/js/bootstrap/nav-tabs.js
jekyll-theme-marketing-0.4.0 assets/js/bootstrap/nav-tabs.js