Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Allow toggling `open` state #5

mathiasbynens opened this Issue · 2 comments

1 participant


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.on('open.details', function() {
}).on('close.details', function() {
$el.details('open'); // opens the element and triggers `open.details`

Added the firing of custom events in 00754e9.


The spec now defines a toggle event on <details> elements:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.