Opened 9 years ago

Closed 7 years ago

Last modified 5 years ago

#3613 closed feature (wontfix)

Accordion: cookie persistence

Reported by: Jörn Zaefferer Owned by:
Priority: major Milestone: 1.6
Component: ui.accordion Version: 1.6rc2
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by Jörn Zaefferer)

Here is an example of adding external cookie persistence to an accordion:

var accordion = $("#accordion");
var index = $.cookie("accordion");
var active;
if (index !== null) {
	active = accordion.find("h3:eq(" + index + ")");
} else {
	active = 0
}
accordion.accordion({
	header: "h3",
	event: "click hoverintent",
	active: active,
	change: function(event, ui) {
		var index = $(this).find("h3").index ( ui.newHeader[0] );
		$.cookie("accordion", index, {
			path: "/"
		});
	},
	autoHeight: false
});

This should be integrated into the plugin, with the option to enable it (requires cookie plugin) and the option to customize the cookie settings, eg. for a different path.

Until the change-option is added, that callback must be used like this (currently untested):

{{{{ $("...").accordion(...).bind("accordionchange", function(event, ui) {

var index = $(this).find("h3").index ( ui.newHeader[0] ); $.cookie("accordion", index, {

path: "/"

});

}); }}}

Change History (6)

comment:1 Changed 9 years ago by Jörn Zaefferer

Milestone: TBD1.next

comment:2 Changed 8 years ago by Jörn Zaefferer

Description: modified (diff)

comment:3 Changed 7 years ago by Scott González

Summary: accordion: cookie persistenceAccordion: cookie persistence
Type: bugfeature

comment:4 Changed 7 years ago by Scott González

Priority: minormajor

comment:5 Changed 7 years ago by Scott González

Resolution: wontfix
Status: newclosed

This shouldn't be built into the core of the accordion.

comment:6 Changed 5 years ago by Scott González

Milestone: 1.next1.6
Note: See TracTickets for help on using tickets.