mathiasbynens / jquery-details

World’s first <details>/<summary> polyfill™
https://mths.be/details
GNU General Public License v2.0
121 stars 34 forks source link

Can this be animated? #21

Open singpolyma opened 10 years ago

singpolyma commented 10 years ago

I tried the following:

$(function() {
  $('details').details().on({
    'open.details': function() {
      $(this).contents(':not(summary)').slideDown();
    },

    'close.details': function() {
      $(this).contents(':not(summary)').slideUp();
    }
  });
});

Which animates (if a little weirdly) on open, but not on close because the hide call from the plugin comes before the animate can finish. I'm wondering if there is a better way to do this? Thanks.