Html5百叶窗效果的示例代码_html5教程技巧


本文摘自PHP中文网,作者韦小宝,侵删。

本篇文章主要介绍了Html5百叶窗效果的示例代码,小编觉得挺不错的,现在分享给大家HTML5源码和解释,也给大家做个参考。对HTML5感兴趣的小伙伴可以一起跟随小编过来看看吧

本文介绍了Html5百叶窗效果的示例代码,分享给大家,具体如下:

实现方法介绍:

1,百叶窗布局 用定位(position: absolute)覆盖在content布局之上,背景设置为透明(background-color: transparent)
2,keyframes定义淡入淡出(透明度改变)和百叶窗口效果动画。
3,启动动画是通过设置DOM的className属性的方法,animator.className = 'baiyeWindow'; 监听动画完成事件'animationend',要清除className属性。
4,在内容布局切换的事件,调用启动动画方法,两个布局都需要绑定切换事件 ng-click="switchLayout()"
5,动画执行时序图:


html代码:


1

2

3

4

5

6

7

8

9

10

11

<!--要显示百叶窗效果的布局--切换内容-->

<p id="fadeInOut" class="content"  ng-click="switchLayout()">

...

</p>

<!--百叶窗布局-->

 <ul id="baiyeWindow"  ng-click="switchLayout()">

       <li><p class="ye"></p></li>

        <li><p class="ye"></p></li>

        <li><p class="ye"></p></li>

        <li><p class="ye"></p></li>

  </ul>


css样式代码:


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

//谈入谈出效果

.fade-animation{

       @-webkit-keyframes fadeInOut {

         0% {

           opacity: 1;

         }

         50% {

           opacity: 0;

         }

         100% {

           opacity: 1;

         }

       }

   @keyframes fadeInOut {

         0% {

           opacity: 1;

         }

         50% {

           opacity: 0;

         }

         100% {

           opacity: 1;

         }

       }

       animation: fadeInOut 1s ease-in;

       -webkit-animation: fadeInOut 1s ease-in;

     }

     //百叶窗效果

     .baiyeWindow{

       width: 100%;

       height: 1.68rem;

       position: absolute;

       left: 0;

       top: 1.2rem;

       li{

         height: 0.42rem;

         line-height: 40px;

         overflow: hidden;

         background-color: transparent;

         .ye{

           -webkit-animation: slideOut 1s ease-in-out;

           animation: slideOut 1s ease-in-out;

           width: 100%;

           background-color: rgba(0,0,0,.2);

           position: relative;

           top: 50%;

         }

       }

       @-webkit-keyframes slideOut {

         0% {

           padding-bottom: 0;

           top: 50%;

         }

         100% {

           padding-bottom: 40px;

           top: 0;

         }

       }

       @keyframes slideOut {

         0% {

           padding-bottom: 0;

           top: 50%;

         }

         100% {

           padding-bottom: 40px;

           top: 0;

         }

       }

     }


阅读剩余部分

相关阅读 >>

解析HTML5应用与原生应用之间的差别

使用h5实现输入框提示语和 正常文本框提示语的方法

HTML5之使用地理定位的代码分享

HTML5 localstorage知识点总结

HTML5幻灯片系统:h5slides

javascript中比较运算符隐式类型转换的介绍(附示例)

如何自定义video播放器样式?

HTML5开始播放当前的音频或视频的方法

HTML5 canvas image的图文代码详解(一)

h5中设置或返回音频/视频的默认播放速度的属性defaultplaybackrate

更多相关阅读请进入《HTML5》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...