diff --git a/core/misc/collapse.js b/core/misc/collapse.js index 767325e..4e0be57 100644 --- a/core/misc/collapse.js +++ b/core/misc/collapse.js @@ -28,6 +28,8 @@ this.setupSummary(); // Initialize and setup the legend. this.setupLegend(); + // Set initial state for section. + this.setupSection(); } $.extend(CollapsibleDetails, /** @lends Drupal.CollapsibleDetails */{ @@ -80,13 +82,24 @@ }, /** + * Set initial state for section element. + */ + setupSection: function() { + this.$section = this.$node.find('section, .details-wrapper'); + + if (!this.$node.attr('open')) { + this.$section.hide(); + } + }, + + /** * Handle legend clicks. * * @param {jQuery.Event} e * The event triggered. */ onLegendClick: function (e) { - this.toggle(); + this.$section.toggle(); e.preventDefault(); },