jQuery中 简易动态演示插件 Presentation.js

  • 源码大小:295.98KB
  • 所需积分:1积分
  • 源码编号:19JP-3688
  • 浏览次数:989次
  • 最后更新:2023年07月11日
  • 所属栏目:幻灯片
本站默认解压密码:19jp.com 或 19jp_com

简介

演示是一种新趋势。无论是推销一个想法,展示你的工作,还是简单地向利益相关者更新你的项目状态,我们都有理由进行演示

这是一个jQuery支持的演示插件,使用户可以创建更专业的演示,并使用很棒的jQuery和/或CSS3动画。玩得开心。

如何使用它:

1.在文档中加载jQuery演示插件的文件。

  1. <script src="/path/to/cdn/jquery.min.js"></script>
  2. <!-- Presentation CSS -->
  3. <link rel="stylesheet" href="css/presentation.css" />
  4. <!-- Presentation js -->
  5. <script src="js/presentation.js"></script>

2.加载Animate.css库以获得很酷的CSS3动画。

  1. <script src="/path/to/cdn/jquery.min.js"></script>
  2. <!-- Presentation CSS -->
  3. <link rel="stylesheet" href="css/presentation.css" />
  4. <!-- Presentation js -->
  5. <script src="js/presentation.js"></script>

3.创建一个容器来容纳您的演示文稿。

  1. <div id="presentationExample"></div>

4.将幻灯片添加到演示文稿中(一组对象)。

  1. var data = [{
  2. // ************************ Slide 1 ************************
  3. // HTML:
  4. // <h1 class="companyName">Your Company Name</h1>
  5. // below CSS styles apply to <h1>:
  6. // #presentationDiv .slide * { position: absolute; font-weight: 300; margin: 0; padding: 0; }
  7. // .companyName { left: 100px; top: -60px; }
  8. // after 1 second HTML will be <h1 class="companyName" style="top: 150px">Your Company Name</h1>
  9. // after 9 seconds HTML will be <h1 class="companyName" style="top: 150px; opacity: 0;">Your Company Name</h1>
  10. name: 'h1', // <h1></h1>
  11. content: "Your Company Name", // <h1>Your Company Name</h1>
  12. attr: { // <h1 class="companyName">Your Company Name</h1>
  13. 'class': 'companyName'
  14. },
  15. animation: ['top', 150, 500, 1000], // 1st and 2nd proparties are style {top: 150px; } and 3rd is a animaton speed "0.5 second" and 4th is time duration "1 second". So after 1 second <h1> has this animation and it will appear in the presentation
  16. cssEffect: { // after 1 second <h1> has flipInY css effect
  17. type: 'flipInY', // CSS effect
  18. time: 1000 // time duration
  19. },
  20. afterAnimation: ['opacity', 0, 1000, 9000] // 1st and 2nd proparties are style {opacity: 0; } and 3rd is a animaton speed "1 second" and 4th is time duration "9 second". So after 9 second <h1> has this animation and it will hide from the presentation
  21. }, {
  22. name: 'img',
  23. attr: {
  24. 'src': 'images/chrome.png',
  25. 'class': 'chrome'
  26. },
  27. animation: ['bottom', 266, 1000, 5000],
  28. cssEffect: {
  29. type: 'flip',
  30. time: 5000
  31. },
  32. afterAnimation: ['opacity', 0, 1000, 9000]
  33. },
  34. // more slides here
  35. ]

5.初始化演示容器上的插件。完成。

  1. $('#presentationDiv').jPresentation({
  2. 'data': data
  3. });

6.设置要在“开始”按钮中显示的文本。

  1. $('#presentationDiv').jPresentation({
  2. 'startButtonText': "Start Presentation",
  3. });

预览截图