mirror of
https://github.com/caojiezi2003/Snavigation.git
synced 2024-11-10 06:39:45 +00:00
124 lines
3.8 KiB
JavaScript
124 lines
3.8 KiB
JavaScript
//加载完成后执行
|
|
window.addEventListener('load', function () {
|
|
//载入动画
|
|
$('#loading-box').attr('class', 'loaded');
|
|
$('#bg').css("cssText", "transform: scale(1);filter: blur(0px);transition: ease 1.5s;");
|
|
$('#section').css("cssText", "opacity: 1;transition: ease 1.5s;");
|
|
$('.cover').css("cssText", "opacity: 1;transition: ease 1.5s;");
|
|
|
|
//用户欢迎
|
|
iziToast.settings({
|
|
timeout: 3000,
|
|
backgroundColor: '#ffffff40',
|
|
titleColor: '#efefef',
|
|
messageColor: '#efefef',
|
|
progressBar: false,
|
|
close: false,
|
|
closeOnEscape: true,
|
|
position: 'topCenter',
|
|
transitionIn: 'bounceInDown',
|
|
transitionOut: 'flipOutX',
|
|
displayMode: 'replace',
|
|
layout: '1'
|
|
});
|
|
setTimeout(function () {
|
|
iziToast.show({
|
|
title: hello,
|
|
message: '欢迎来到 Snavigation'
|
|
});
|
|
}, 800);
|
|
|
|
}, false)
|
|
|
|
//屏蔽浏览器默认右键
|
|
// document.oncontextmenu = function () {
|
|
// undefined
|
|
// return false;
|
|
// }
|
|
|
|
//获取时间
|
|
var t = null;
|
|
t = setTimeout(time, 1000);
|
|
|
|
function time() {
|
|
clearTimeout(t);
|
|
dt = new Date();
|
|
var mm = dt.getMonth() + 1;
|
|
var d = dt.getDate();
|
|
var weekday = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
|
|
var day = dt.getDay();
|
|
var h = dt.getHours();
|
|
var m = dt.getMinutes();
|
|
if (h < 10) {
|
|
h = "0" + h;
|
|
}
|
|
if (m < 10) {
|
|
m = "0" + m;
|
|
}
|
|
$("#time_text").html(h + '<span id="point">:</span>' + m);
|
|
$("#day").html(mm + " 月 " + d + " 日 " + weekday[day]);
|
|
t = setTimeout(time, 1000);
|
|
}
|
|
|
|
//获取天气
|
|
//每日限量 100 次
|
|
//请前往 https://www.tianqiapi.com/index/doc?version=v6 申请(免费)
|
|
fetch('https://yiketianqi.com/api?unescape=1&version=v6&appid=43986679&appsecret=TksqGZT7')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
//$('#wea_text').html(data.wea + ' ' + data.tem_night + '℃' + ' ~ ' + data.tem_day + '℃')
|
|
$('#wea_text').text(data.wea)
|
|
$('#tem1').text(data.tem1)
|
|
$('#tem2').text(data.tem2)
|
|
})
|
|
.catch(console.error)
|
|
|
|
//火狐浏览器独立样式
|
|
if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
|
|
var head = document.getElementsByTagName('head')[0];
|
|
var link = document.createElement('link');
|
|
link.href = './css/firefox.css';
|
|
link.rel = 'stylesheet';
|
|
link.type = 'text/css';
|
|
head.appendChild(link);
|
|
window.addEventListener('load', function () {
|
|
setTimeout(function () {
|
|
iziToast.show({
|
|
timeout: 8000,
|
|
message: '您正在使用火狐浏览器,部分功能可能不支持'
|
|
});
|
|
}, 3800);
|
|
}, false)
|
|
}
|
|
|
|
//Tab书签页
|
|
$(function () {
|
|
$(".mark .tab .tab-item").click(function () {
|
|
$(this).addClass("active").siblings().removeClass("active");
|
|
$(".products .mainCont").eq($(this).index()).css("display", "flex").siblings().css("display", "none");
|
|
})
|
|
})
|
|
|
|
//设置
|
|
$(function () {
|
|
$(".set .tabs .tab-items").click(function () {
|
|
$(this).addClass("actives").siblings().removeClass("actives");
|
|
$(".productss .mainConts").eq($(this).index()).css("display", "flex").siblings().css("display", "none");
|
|
})
|
|
})
|
|
|
|
//监听网页宽度
|
|
// window.addEventListener('load', function () {
|
|
// if (window.innerWidth <= 512) {
|
|
// $('.wd').attr('placeholder', '搜索');
|
|
// } else {
|
|
// $('.wd').attr('placeholder', '想要搜点什么');
|
|
// }
|
|
// window.addEventListener('resize', function () {
|
|
// if (window.innerWidth <= 512) {
|
|
// $('.wd').attr('placeholder', '搜索');
|
|
// } else {
|
|
// $('.wd').attr('placeholder', '想要搜点什么');
|
|
// }
|
|
// })
|
|
// })
|