views:

110

answers:

1

Hi I need to be able to click a special menu link on the homepage and have it open a page with an accordion open to a different section other then the one that is normally active (0) when you visit the page from the default (different) menu link. I am pretty new to jQuery but I think I can follow proposed solutions.

Thanks!

A: 

What I can think of, is that you can send a var via your URL and GET it in the target page, and depending on the value of this var, you open/close whatever accordion section you want. For a javascript function to get values, you can do something like this:

function getUrlVars() {
var map = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
 map[key] = value;
});
return map;
}

Source

Soufiane Hassou
so if my link is /administrative.html?acc=4 then it should pass 'acc' = 4 to getUrlVars...then what is the js to activate the panel? "what goes here?" .accordion ('activate' , 4)
Keith Lyon
I also did an alert(getUrlVars); and no pop up box was returned.
Keith Lyon
try : var map = getUrlVars(); alert(map['acc']);
Soufiane Hassou