Commit 52a3f4b3 by doszhang

dos

parent 9cf9bcde
......@@ -101,7 +101,28 @@ const video3 = document.getElementById("video3");
$('.page1').show();
preloadimages(preloadImageList, function () {}, function (progress) {});
$(document).ready(function () {
var EventUtil = {
addHandler: function (element, type, handler) {
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else if (element.attachEvent) {
element.attachEvent("on" + type, handler);
} else {
element["on" + type] = handler;
}
}
};
(function () {
var showCount = 0;
EventUtil.addHandler(window, "load", function () {});
EventUtil.addHandler(window, "pageshow", function (event) {
showCount++;
alert("Show has been fired " + showCount + " times.");
});
$(document).ready(function () {
for (let i = 0; i < 21; i++) {
$('.read' + i).hide();
}
......@@ -245,9 +266,9 @@ $(document).ready(function () {
link: linkAddress.link20,
index: 20
}, jumpTolink);
});
});
function jumpTolink(event) {
function jumpTolink(event) {
const link = event.data.link;
if (event.data.index || event.data.index == 0) {
const index = event.data.index;
......@@ -259,10 +280,10 @@ function jumpTolink(event) {
window.location.href = link;
}, 100);
}
}
function getTranslateDistance(cardinal = 0, abs = false) {
function getTranslateDistance(cardinal = 0, abs = false) {
var wrapInnerTransform = $('.wrap-inner').css('transform');
var wrapInnertop = parseFloat($('.wrap-inner').css('top'));
wrapInnerTransform = wrapInnerTransform.match(/^matrix\(1,\s0,\s0,\s1,\s0,\s\-?(\d+)/);
......@@ -274,29 +295,29 @@ function getTranslateDistance(cardinal = 0, abs = false) {
}
return wrapInnerjl + cardinal + 'px';
}
}
//获取随机数方法
//min 最小值
//max 最大值
function RandomNumBoth(Min, Max) {
//获取随机数方法
//min 最小值
//max 最大值
function RandomNumBoth(Min, Max) {
var Range = Max - Min;
var Rand = Math.random();
var num = Min + Math.round(Rand * Range); //四舍五入
return num;
}
}
//写cookies
//写cookies
function setCookie(name, value) {
function setCookie(name, value) {
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}
}
//读取cookies
function getCookie(name) {
//读取cookies
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg))
......@@ -304,4 +325,4 @@ function getCookie(name) {
return unescape(arr[2]);
else
return null;
}
\ No newline at end of file
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment