Skip to main content

Search and Top Navigation

#3613 closed feature (wontfix)

Opened November 20, 2008 08:34AM UTC

Closed October 21, 2010 03:02AM UTC

Last modified October 03, 2012 03:36PM UTC

Accordion: cookie persistence

Reported by: jzaefferer Owned by:
Priority: major Milestone: 1.6
Component: ui.accordion Version: 1.6rc2
Keywords: Cc:
Blocked by: Blocking:
Description

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: "/"
		});
});
Attachments (0)
Change History (6)

Changed November 30, 2008 01:26PM UTC by jzaefferer comment:1

milestone: TBD1.next

Changed November 30, 2008 09:51PM UTC by jzaefferer comment:2

description: 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.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: "/" \ }); \ }); \ }}} \

Changed July 12, 2010 12:24PM UTC by scottgonzalez comment:3

summary: accordion: cookie persistenceAccordion: cookie persistence
type: bugfeature

Changed July 14, 2010 04:50PM UTC by scottgonzalez comment:4

priority: minormajor

Changed October 21, 2010 03:02AM UTC by scottgonzalez comment:5

resolution: → wontfix
status: newclosed

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

Changed October 03, 2012 03:36PM UTC by scottgonzalez comment:6

milestone: 1.next1.6