看来,这比“。 并非所有工作都容易遵循,<代码>(<>>>>>>功能似乎没有广告。
从您的提问来看,你希望通过提及一分之四来开一个礼节。 无法从盒子中提取;你只能确定使用0基指数的章节(如0 = 第一部分,1 = 第二节等)。
说到这一点后,这种办法将发挥作用:
界定这种联系:
<a href="10387904_Accordion_link_2.html?openAccordionId=0">Open first item</a>
<a href="10387904_Accordion_link_2.html?openAccordionId=1">Open second item</a>
<a href="10387904_Accordion_link_2.html?openAccordionId=2">Open third item</a>
On the page containing the accordion, use the following code to extract the ID from the query string and initialise the accordion with the relevant section activated:
// Using the parseQueryString extension from
// http://paulgueller.com/2011/04/26/parse-the-querystring-with-jquery/
$.extend({
parseQuerystring: function () {
var nvpair = {};
var qs = window.location.search.replace( ? , );
var pairs = qs.split( & );
$.each(pairs, function (i, v) {
var pair = v.split( = );
nvpair[pair[0]] = pair[1];
});
return nvpair;
}
});
// Get the index of the section we want to open from the querystring.
var openAccordionId = parseInt($.parseQuerystring()["openAccordionId"]);
// Initialise the accordion with the active section defined.
var accordion = $("#accordion").accordion({ active: openAccordionId });
// Note: for some reason, the following does not work:
// var accordion = $("#accordion").accordion();
// accordion.activate(openAccordionId);