1
Surpriseplus
2022-09-16 8d1a91c23df335b090e38b2edd15203aa3b03da9
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/**
 * Created by ChengYa on 2016/6/18.
 */
 
//判断手机类型
window.onload = function () {
  loading();
};
 
//加载图片
var loading_img_url = [
  "./image/1.png",
  "./image/2.png",
  "./image/3.png",
  "./image/4.png",
  "./image/5.png",
  "./image/6.png",
  "./image/7.png",
  "./image/8.png",
  "./image/9.png",
  "./image/10.png",
  "./image/11.png",
  "./image/12.png",
  "./image/13.png",
  "./image/14.png",
  "./image/15.png",
  "./image/16.png",
  "./image/17.png",
  "./image/18.png",
  "./image/19.png",
  "./image/20.png",
  "./image/21.png",
  "./image/22.png",
  "./image/23.png",
  "./image/24.png",
  "./image/25.png",
  "./image/26.png",
  "./image/27.png",
  "./image/28.png",
];
 
//加载页面
function loading () {
  var numbers = 0;
  var length = loading_img_url.length;
 
  // for (var i = 0; i < 28; i++) {
  //   var img = new Image();
  //   img.src = loading_img_url[i];
  //   img.onerror = function () {
  //     numbers += (1 / length) * 100;
  //   };
  // img.onload = function () {
  // numbers += (1 / length) * 100;
  // $(".number").html(parseInt(numbers) + "%");
  // console.log(numbers);
 
  // if (Math.round(numbers) == 100) {
  //$('.number').hide();
  // date_end = getNowFormatDate();
  // var loading_time = date_end - date_start;
  // //预加载图片
  // $(function progressbar () {
  //   //拼接图片
  //
  //   var tagHtml = "";
  //   for (var i = 1; i <= 28; i++) {
  //     tagHtml +=
  //       ' <div style="background:url(image/' +
  //       i +
  //       '.png) no-repeat center;background-size:100% 100%"></div>';
  //   }
  //   $(".flipbook").append(tagHtml);
  //   var w = $(".graph").width();
  //   $(".flipbook-viewport").show();
  // });
 
  //配置turn.js
  function loadApp () {
    var w = $(window).width();
    var h = $(window).height();
    //   var w = "900px";
    //   var h = "600px";
    $(".flipboox").width(w).height(h);
    $(window).resize(function () {
      w = $(window).width();
      h = $(window).height();
      // w = "900px";
      // h = "600px";
      $(".flipboox").width(w).height(h);
    });
    $(".flipbook").turn({
      // Width
      width: w,
      // Height
      height: h,
      // Elevation
      elevation: 50,
      display: "single",
      // Enable gradients
      gradients: true,
      // Auto center this flipbook
      // autoCenter: true,
 
      when: {
        turning: function (e, page, view) {
          var total = $(".flipbook").turn("pages"); //总页数
          if (page !== 1) {
            $(".previousPage").css("display", "block");
          }
          if (page == total) {
            $(".nextPage").css("display", "none");
          }
          if (page !== total) {
            $(".nextPage").css("display", "block");
          }
        },
        turned: function (e, page, view) {
          var total = $(".flipbook").turn("pages"); //总页数
          if (page == 1) {
            $(".previousPage").css("display", "none");
          }
          if (page == total) {
            $(".nextPage").css("display", "none");
          }
        },
      },
    });
  }
  yepnope({
    test: Modernizr.csstransforms,
    yep: ["js/turn.js"],
    complete: loadApp,
  });
  // }
  // };
  // }
}
 
function getNowFormatDate () {
  var date = new Date();
  var seperator1 = "";
  var seperator2 = "";
  var month = date.getMonth() + 1;
  var strDate = date.getDate();
  if (month >= 1 && month <= 9) {
    month = "0" + month;
  }
  if (strDate >= 0 && strDate <= 9) {
    strDate = "0" + strDate;
  }
  var currentdate =
    date.getFullYear() +
    seperator1 +
    month +
    seperator1 +
    strDate +
    "" +
    date.getHours() +
    seperator2 +
    date.getMinutes() +
    seperator2 +
    date.getSeconds();
  return currentdate;
}
 
//上一页
$(".previousPage").bind("click", function () {
  var pageCount = $(".flipbook").turn("pages"); //总页数
  var currentPage = $(".flipbook").turn("page"); //当前页
  if (currentPage >= 2) {
    $(".flipbook").turn("page", currentPage - 1);
  } else {
  }
});
// 下一页
$(".nextPage").bind("click", function () {
  var pageCount = $(".flipbook").turn("pages"); //总页数
  var currentPage = $(".flipbook").turn("page"); //当前页
  if (currentPage <= pageCount) {
    $(".flipbook").turn("page", currentPage + 1);
  } else {
  }
});