p2.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
  7. <link rel="stylesheet" href="../css/weui.css"/>
  8. <link rel="stylesheet" href="../css/weuix.css"/>
  9. <script src="../js/zepto.min.js"></script>
  10. <script src="../js/zepto.fullpage.js"></script>
  11. <style>
  12. .page{
  13. font-size: 72px;
  14. line-height: 200px;
  15. text-align: center;
  16. }
  17. .page1{
  18. background: red;
  19. }
  20. .page2{
  21. background: blue;
  22. }
  23. .page3{
  24. background: #de21c8;
  25. }
  26. .page4{
  27. background: green;
  28. }
  29. .indicator{
  30. position: fixed;
  31. right: 10px;
  32. top: 50%;
  33. margin-top: -40px;
  34. }
  35. .indicator li{
  36. margin-top: 10px;
  37. width: 10px;
  38. height: 10px;
  39. border-radius: 100px;
  40. background: rgba(0,0,0,0.5);
  41. text-indent: -9999px;
  42. list-style: none;
  43. }
  44. .indicator li.cur{
  45. background: rgba(255,255,255,0.5);
  46. }
  47. </style>
  48. <script>
  49. $(function(){
  50. $('#fullpage').fullpage({
  51. change: function (e) {
  52. console.log('change', e.next, e.cur);
  53. $('.indicator li').removeClass('cur').eq(e.cur).addClass('cur');
  54. },
  55. beforeChange:function(e){
  56. console.log('beforeChange', e.next, e.cur);
  57. if(e.next ==2){ //第三页停止 从0开始计算
  58. $.fn.fullpage.stop()
  59. } else {
  60. $.fn.fullpage.start()
  61. }
  62. },
  63. afterChange: function (e) {
  64. console.log('afterChange', e.next, e.cur);
  65. },
  66. loop:true
  67. });
  68. });
  69. </script>
  70. </head>
  71. <body ontouchstart>
  72. <div class="fullpage">
  73. <div id="fullpage">
  74. <div class="page page1">1</div>
  75. <div class="page page2">2</div>
  76. <div class="page page3">
  77. <a href="javascript:;" class="weui-btn weui-btn_primary" onclick="$.fn.fullpage.moveNext(true);">下一页</a>
  78. </div>
  79. <div class="page page4">4</div>
  80. </div>
  81. <ul class="indicator">
  82. <li>1</li>
  83. <li>2</li>
  84. <li>3</li>
  85. <li>4</li>
  86. </ul>
  87. </div>
  88. <span class="start"><b></b></span>
  89. </body>
  90. </html>