After reading those two questions:

看完这两个问题后:

  • How To Add CSS3 Transition With HTML5 details/summary tag reveal?
  • 如何添加CSS3转换HTML5详细信息/摘要标记显示?

  • How to make <'details'> drop down on mouse hover
  • 如何使<'详细信息'>下拉鼠标悬停

I have a new one for you!

我有一个新的给你!

Problem

I want an animation on closing event of the <details> tag. I thought that just revert the animation of opening would do the job, but unfortunately, no.

我希望在

标签的结束事件上播放动画。我认为只要恢复开放的动画就可以完成这项工作,但不幸的是,没有。

$(function() {
  $('details').on('mouseover', function() {
    $(this).attr('open', true);
  }).on('mouseout', function() {
    $(this).attr('open', false);
  }).on('click', function(e) {
    e.preventDefault();
  })
});
details[open] SUMMARY~* {
  animation: sweepin .5s ease-in-out;
}

details[close] SUMMARY~* {
  animation: sweepout .5s ease-in-out;
}

@keyframes sweepin {
  0% {
    opacity: 0;
    margin-left: -10px
  }
  100% {
    opacity: 1;
    margin-left: 0px
  }
}

@keyframes sweepout {
  0% {
    opacity: 1;
    margin-left: 0px
  }
  100% {
    opacity: 0;
    margin-left: -10px
  }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<details>
  <summary>Here my little summary</summary>
  <p>... Do you want more details?</p>
  <p>Here have some details!</p>
</details>

更多相关文章

  1. 动态左侧的GreenSock javascript动画
  2. 从屏幕外动画div,没有绝对位置?
  3. 如果在详细信息表中找到记录,则显示Y / N列
  4. 提供一个Android原生的Progress——SwipeToRefreshLayout下拉刷
  5. Android 5.X Activity过渡动画,以及漂亮的共享元素效果
  6. Android动画精讲一:从setTranslationX谈属性动画和view动画的区别
  7. [置顶] Animation之TranslateAnimation(平移动画)
  8. 导航架构组件 - 具有CollapsingToolbar的详细信息视图
  9. Android 属性动画(Property Animation)

随机推荐

  1. android Gradle打包修改生成的apk文件名
  2. Could not find com.android.tools.build
  3. Android read system font
  4. [转]使HOME键有效
  5. android 电容屏(二):驱动调试之基本概念篇
  6. Android—Android中监听EditText文本输入
  7. Android(安卓)获取屏幕高度、标题高度、
  8. DataBing
  9. Android问题集(七)——TableLayout 中让Tab
  10. Android实现朋友圈多图显示功能