New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow toggling `open` state #5

Open
mathiasbynens opened this Issue Jan 8, 2012 · 2 comments

Comments

Projects
None yet
1 participant
@mathiasbynens
Owner

mathiasbynens commented Jan 8, 2012

LedgeT describes a use case here:

I have a responsive design that requires the details to be closed in one view but open in another. Is it possible to do this based on changing the parent class?

E.g. $(el).details('toggle'); would toggle the open attribute and property, as well as class="open".

Maybe also $(el).details('open') and $(el).details('close').

This could also trigger event handlers:

$el.details();
$el.on('open.details', function() {
  console.log('open');
}).on('close.details', function() {
  console.log('close');
});
$el.details('open'); // opens the element and triggers `open.details`
@mathiasbynens

This comment has been minimized.

Show comment
Hide comment
@mathiasbynens

mathiasbynens Feb 7, 2012

Owner

Added the firing of custom events in 00754e9.

Owner

mathiasbynens commented Feb 7, 2012

Added the firing of custom events in 00754e9.

@mathiasbynens

This comment has been minimized.

Show comment
Hide comment
@mathiasbynens

mathiasbynens Nov 6, 2013

Owner

The spec now defines a toggle event on <details> elements: http://html5.org/tools/web-apps-tracker?from=8250&to=8251

Owner

mathiasbynens commented Nov 6, 2013

The spec now defines a toggle event on <details> elements: http://html5.org/tools/web-apps-tracker?from=8250&to=8251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment