/**
|
* 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 {
|
}
|
});
|