var light=setInterval(function () {
if($('.today-con>li>div').hasClass('active')){
$('.today-con>li>div').removeClass('active');
}else{
$('.today-con>li>div').addClass('active');
}
setTimeout(function () {
if($('.today-con>li>div').hasClass('active')){
$('.today-con>li>div').removeClass('active');
}else{
$('.today-con>li>div').addClass('active');
}
},2000)
},4000)
function pop(name) {
var Bubblearr=[];
var Bubble = document.getElementById(name);
let ctx = Bubble.getContext('2d');
let i = 0;
setInterval(() => {
ctx.clearRect(0, 0, 200, 264)
let r = Math.random() * 5
let y = 264 - r
let x = Math.random() * 100
let a = 1
let speed = Math.random() * 5 + 5
if (x > 50) {
x += 98 - r
} else {
x += r
}
if (i === 0) {
Bubblearr.push({
'x': x,
'y': y,
'r': r,
'a': a,
'speed': speed
})
i = 1
} else {
i = 0
}
for (let i = 0; i < Bubblearr.length; i++) {
ctx.beginPath()
ctx.arc(Bubblearr[i].x, Bubblearr[i].y, Bubblearr[i].r, 0, Math.PI * 2, true)
ctx.strokeStyle = 'rgba(255,255,255,' + Bubblearr[i].a + ')'
Bubblearr[i].y -= Bubblearr[i].speed
Bubblearr[i].a -= 0.02
if (Bubblearr[i].y <= 0 || Bubblearr[i].a <= 0) {
Bubblearr.splice(i, 1)
}
ctx.stroke()
ctx.closePath()
}
}, 50);
}
pop('pop');
pop('pop1');
pop('pop2');
$('.nav>li').click(function () {
$('.nav>li').removeClass('active');
$(this).addClass('active');
})
var doscroll = function(){
var $parent = $('.js-slide-list');
var $first = $parent.find('li:first');
var height = $first.height();
$first.animate({
height: 0
}, 500, function() {
$first.css('height', height).appendTo($parent);
});
};
var setInter=setInterval(function(){doscroll()}, 2000);
var doscroll1 = function(){
var $parent = $('.js-slide-list1');
var $first = $parent.find('li:first');
var height = $first.height();
$first.animate({
height: 0
}, 500, function() {
$first.css('height', height).appendTo($parent);
});
};
var setInter1=setInterval(function(){doscroll1()}, 2000);
function time() {
var myDate = new Date();
var day = myDate.toLocaleDateString();
var hours = myDate.getHours();
var min = myDate.getMinutes();
var sec = myDate.getSeconds();
if(hours<10){
hours="0"+hours;
}
if(min<10){
min="0"+min;
}
if(sec<10){
sec="0"+sec;
}
var time = day + ' ' + hours + ':' + min + ':' + sec;
$('.time').html(time);
}
var timeInter=setInterval(function(){time()}, 1000);
var city;
function tt(){
$.ajax({
url: 'http://pv.sohu.com/cityjson?ie=utf-8',
dataType: "script",
async: false,
success: function(){
city = returnCitySN.cname;
var a = city.indexOf("省",0);
if(a >= 0){
city = city.substring(a+1);
}
var cityid=returnCitySN.cid;
var url = "https://www.tianqiapi.com/api/?version=v6&appid=18329817&appsecret=baqIYQ7D&cityid=" + cityid;
$.ajax({
url: url,
dataType: "json",
async: false,
success: function (data) {
$('.tem').html(data.tem+'℃');
$('.humidity').html(data.humidity);
$('.wea').html(data.wea);
$('.win_speed').html(data.win_speed);
if(data.wea=='下雨'){
$('.wea-img').attr('src','./img/rain.svg');
}else if(data.wea=='晴'){
$('.wea-img').attr('src','./img/sun.svg');
}else if(data.wea=='下雪'){
$('.wea-img').attr('src','./img/snow.svg');
}else if(data.wea=='多云'){
$('.wea-img').attr('src','./img/header-4.svg');
}else{
$('.wea-img').attr('src','./img/header-4.svg');
}
}
})
}
});
}
tt();