//雷达图
var HNRadar = {
n: -1,
time: 1000,
time2:null,
LodaData: function () {
$.ajax({
type: "GET",
url: "/HNRadar/HNRadarList.js?t=" + Math.random(),
//dataType: "json",
success: function (imgList) {
var imgjsonList = eval(imgList);
$(".rad_li2 .ldPic").attr("src", "/" + imgjsonList[0]);
HNRadar.PlayPic(imgjsonList);
}
});
//1时内图片
$.ajax({
type: "GET",
url: "/HNRadar/HNRadarsixHourList.js?t=" + Math.random(),
dataType:"json",
success: function (json) {
var _sixHourImg = $(".rad_li2 .sixHourImg");
$.each(json, function (key, content) {
if (key < 12)//只显示12张图片
$("" + content[1] + "").appendTo(_sixHourImg);
})
$(".rad_li2 .sixHourImg a").bind("click", function () {
$(".rad_li2 .ldPic").attr("src", $(this).attr("rel"));
$(".rad_li2 .timeStart i").html($(this).text())
HNRadar.playStop();
$(".rad_li2 .ldpage p span").removeClass("hover");
})
}
});
},
PlayPic: function (Dayun_radar_a) {
//反序
var Dayun_radar =Array();
for (var i = Dayun_radar_a.length-1; i >= 0 ; i--) {
Dayun_radar.push(Dayun_radar_a[i]);
}
if (typeof Dayun_radar == 'undefined' || Dayun_radar == null) return;
var sd = ''; ulcontent = '';
for (var i = 1;i <= Dayun_radar.length; i++) {
ulcontent += '' + (i) + '';
}
$(".rad_li2 .ldpage p").empty();
$(".rad_li2 .ldpage p").append(ulcontent);
time = 1000;
var $span = $(".rad_li2 .ldpage p span");
var n = count = -1;
count = $span.size() - 1;
$(".rad_li2 .ldplay").bind("click", function () {
if ($(this).hasClass("stop")) { clearInterval(HNRadar.time2); $(this).removeClass("stop").attr("src", "/images/ldNext.jpg").attr("title", "播放"); } else {
$(this).addClass("stop").attr("src", "/images/ldstop.jpg").attr("title", "暂停");
HNRadar.time2 = setInterval(function () { HNRadar.showAuto($span, Dayun_radar); }, HNRadar.time);
}
});
$span.bind("click", function () {
var i = $(this).index();
HNRadar.picChang(i, $span, Dayun_radar);
HNRadar.playStop();
})
$(".rad_li2 .ldRight img.ldPic").bind("click", function () {
$(".rad_li2 .ldplay").click();
})
//播放
$(".rad_li2 .ldplay").click();
$(".rad_li2 .stemp a").bind("click", function () {
ctime = $(this).attr("rel");
clearInterval(HNRadar.time2);
HNRadar.time2 = setInterval(function () { HNRadar.showAuto($span, Dayun_radar); }, ctime);
})
},
showAuto: function ($span, Dayun_radar) {
HNRadar.n = HNRadar.n >= (count) ? 0 : HNRadar.n + 1;
HNRadar.picChang(HNRadar.n, $span, Dayun_radar);
//$span.eq(Radar.n).trigger('click');
},
picChang: function (i, $span, Dayun_radar) {
//debugger;
HNRadar.n = i;
$(".rad_li2 .ldPic").attr("src", Dayun_radar[HNRadar.n]);
var s = $span.eq(Radar.n);
$span.eq(HNRadar.n).siblings().removeClass("hover");
$span.eq(HNRadar.n).addClass("hover");
},
playStop: function () {
// debugger;
if (HNRadar.time2 != null)
clearInterval(HNRadar.time2);
$(".rad_li2 .ldplay").removeClass("stop").attr("src", "/images/ldNext.jpg").attr("title", "播放");
}
}