0

Basically i have my sidebar which is on every page of my site. How do i link it to the user desired idTab when clicked which is on the other page. notice that they are 2 separate pages.

im currently using Sean Catchpole idTabs 3.0 beta here's the link: http://www.sunsean.com/idTabs/

DodgeThat
  • 19
  • 1
  • 2
  • 7

1 Answers1

0

One way to attack it is by adding a url variable to the link in the sending page, (i.e. ?tabLink="software"), where the name matches the id of the tab url on the receiving page (i.e. <a href="#sw" id="software">).

On the receiving page, get the query string. This function works well (code from How can I get query string values in JavaScript?):

(function($) {
    $.QueryString = (function(a) {
        if (a == "") return {};
            var b = {};
            for (var i = 0; i < a.length; ++i) {
                var p=a[i].split('=');
                if (p.length != 2) continue;
                    b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
                }
                return b;
    })(window.location.search.substr(1).split('&'))
})(jQuery);

Then use it like this:

$("#" + $.QueryString["tabLink"]).click();
Community
  • 1
  • 1