Sha256: 944cb0605b7120a425defbb744cbb71a6458aa96b57173cdf142fe57c35d81b3

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 Bytes

Contents

(function( $ ){
  
  $.fn.foundationTabs = function(options) {
    
    var settings = $.extend({
      callback: $.noop
    }, options);
    
    var activateTab = function($tab) {
      var $activeTab = $tab.closest('dl').find('dd.active'),
          contentLocation = $tab.children('a').attr("href") + 'Tab';

      // Strip off the current url that IE adds
      contentLocation = contentLocation.replace(/^.+#/, '#');

      //Make Tab Active
      $activeTab.removeClass('active');
      $tab.addClass('active');

      //Show Tab Content
      $(contentLocation).closest('.tabs-content').children('li').removeClass('active').hide();
      $(contentLocation).css('display', 'block').addClass('active');
    };
    
    $('dl.tabs dd a', this).on('click.fndtn', function(event){
      activateTab($(this).parent('dd'));
    });
    
    if (window.location.hash) {
      activateTab($('a[href="' + window.location.hash + '"]').parent('dd'));
      settings.callback();
    }
    
  };

})( jQuery );

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zurb-foundation-3.0.6 vendor/assets/javascripts/foundation/jquery.foundation.tabs.js