Ticket #3613 (new feature)

Opened 22 months ago

Last modified 7 weeks ago

Accordion: cookie persistence

Reported by: joern.zaefferer Owned by:
Priority: major Milestone: 1.next
Component: ui.accordion Version: 1.6rc2
Keywords: Cc:

Description (last modified by joern.zaefferer) (diff)

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

Changed 21 months ago by joern.zaefferer

  • milestone changed from TBD to 1.next

Changed 21 months ago by joern.zaefferer

  • description modified (diff)

Changed 7 weeks ago by scott.gonzalez

  • type changed from bug to feature
  • summary changed from accordion: cookie persistence to Accordion: cookie persistence

Changed 7 weeks ago by scott.gonzalez

  • priority changed from minor to major
Note: See TracTickets for help on using tickets.