Sha256: 071a84f995dc75d357db2d2a25fa90bd176d5b9e4edd13f9c12fa8809f58af6b

Contents?: true

Size: 774 Bytes

Versions: 30

Compression:

Stored size: 774 Bytes

Contents

$(document).ready(function() {
  var $tab_with_error = $(".form-control.is-invalid").first().closest('.tab-pane');

  if ($tab_with_error.length > 0) {
    $(".nav.nav-tabs").find("a[href^='#" + $tab_with_error.attr('id') + "']").tab('show');
  } else if (document.location.hash.length > 0) {
    var $tab_from_url = $(".nav.nav-tabs").find("a[href^='" + document.location.hash + "']");

    if ($tab_from_url.length > 0) {
      document.location.hash = ""; // This prevents scrolling to the wrong place in the page
      $tab_from_url.tab("show");
    }
  }
});

$(document).on('click', '[data-click-tab]', function(event) {
  event.preventDefault();

  var href = $(event.currentTarget).attr('href');
  $('.nav.nav-tabs').find("a[href^='" + href + "']").tab('show');
});

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
effective_bootstrap-0.10.5 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.4 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.3 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.2 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.1 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.0 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.49 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.48 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.47 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.46 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.45 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.44 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.43 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.42 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.41 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.40 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.39 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.38 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.37 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.9.36 app/assets/javascripts/effective_bootstrap/tabs.js