Hi,

I've replaced my User view with a Panels Page, styled as Tabs. I'd like to link to specific tabs from various places in the site, along the lines of www.sitename.com/user/some_username?tab=3 or www.sitename.com/user/some_username?tab=edit .

Obviously the URL will not change when switching tabs, but I think the option to define which tab will be opened on page load is significant.

Any chance of this happening?

Thanks,

Tal

Comments

valante’s picture

Bump . . . Any takers?

mstrelan’s picture

The downside of using Flag instead of subscribing via comments is that no one else can see that I have +1'd this.

mstrelan’s picture

dazz’s picture

I had the same problem, you have to add something like the following to the for loop in panel_tabs.js

$('#' + tabsID[key] + ' ul li a').click(function () {
    location.hash = $(this).attr('href');
});

The whole code:

(function ($) {

/**
 * JS related to the tabs in the Panels tabs.
 */
Drupal.behaviors.panelsTabs = {
  attach: function (context) {
    var tabsID = Drupal.settings.panelsTabs.tabsID;
    
    for (var key in Drupal.settings.panelsTabs.tabsID) {  
      $('#' + tabsID[key] +':not(.tabs-processed)', context)
        .addClass('tabs-processed')
        .tabs();
      $('#' + tabsID[key] + ' ul li a').click(function () {
          location.hash = $(this).attr('href');
      });
    } 
  }
};

})(jQuery);
ar-jan’s picture

I have tried the solution in #4 and it seems to work, but not reliably. I.e. after visiting a path like node/123#tabs-0-middle-3 it starts with the 3rd tab, but changing the path to node/123#tabs-0-middle-2 the correct tab doesn't always get selected (maybe some caching issue?).

Also when using such a link, for the first tab it loads just below the actual tab, for the second somewhere in the middle of the page, and the third even lower on the page. So this seems to somehow use the vertical position as if the content of the panes was displayed below each other.

Anyone else notice this? And is this a proper solution in the first place? (it seems the added code acts on a mouse click, which is not the same as visiting a path?)

EstherVillars’s picture