/ / jQuery Vallenato Accordian Display - jquery, akordeón, predvolené

jQuery Vallenato Accordian Display - jquery, akordeón, predvolené

Tento jQuery accordionský skript zobrazuje štandardný prvý accordánsky obsah. Ako by som nastavil, aby sa tretí accordánsky obsah zobrazoval ako predvolené? Vopred ďakujem!

$(document).ready(function()
{
//Add Inactive Class To All Accordion Headers
$(".accordion-header").toggleClass("inactive-header");

//Set The Accordion Content Width
var contentwidth = $(".accordion-header").width();
$(".accordion-content").css({"width" : contentwidth });

//Open The First Accordion Section When Page Loads
$(".accordion-header").first().toggleClass("active-header").toggleClass("inactive-header");
$(".accordion-content").first().slideDown().toggleClass("open-content");


// The Accordion Effect
$(".accordion-header").click(function () {
if($(this).is(".inactive-header")) {
$(".active-header").toggleClass("active-header").toggleClass("inactive-header").next().slideToggle().toggleClass("open-content");
$(this).toggleClass("active-header").toggleClass("inactive-header");
$(this).next().slideToggle().toggleClass("open-content");
}

else {
$(this).toggleClass("active-header").toggleClass("inactive-header");
$(this).next().slideToggle().toggleClass("open-content");
}
});

return false;
});

http://www.switchroyale.com/vallenato/

odpovede:

1 pre odpoveď č. 1

Odstrániť tieto riadky:

//Open The First Accordion Section When Page Loads
$(".accordion-header").first().toggleClass("active-header").toggleClass("inactive-header");
$(".accordion-content").first().slideDown().toggleClass("open-content");

A pridajte toto:

$(".accordion-header:eq(2)").toggleClass("active-header").toggleClass("inactive-header");
$(".accordion-content:eq(2)").slideDown().toggleClass("open-content");

Časť s :eq(2) definuje predvolenú sekciu