I need to trigger a event when a specific horizontal tab has been focused. Probably it should be done implementing a the javascript hook but I can't figure out how. The only way I found is to modify directly horizontal-tabs.js putting this code in line 133, but for sure that is really a bad solution:

if (this.item.hasClass('horizontal-tab-button-3')) //do something


zuuperman’s picture

Issue summary: View changes
Status: Active » Fixed

You can do this by adding your own javascript and use http://api.jquery.com/focus/ on the fieldset that represents the tab content.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ropic’s picture

Not working for me, i needed to overwrite the focus method and fire a custom event:

Drupal.horizontalTab.prototype.focus = function () {
        .each(function () {
          var tab = $(this).data('horizontalTab');
    // Mark the active tab for screen readers.
    this.link.append('<span id="active-horizontal-tab" class="element-invisible">' + Drupal.t('(active tab)') + '</span>');