//卫星云图 var Cloud = { n: 0, LodaData: function () { $.ajax({ type: "GET", url: "/Cloud/CloudList-fy2e.js?t=" + Math.random(), success: function (imgList) { var imgjsonList = eval(imgList); if (imgjsonList.length == 0) { $.ajax({ type: "GET", url: "/Cloud/CloudList-fy2d.js?t=" + Math.random(), success: function (imgList) { imgjsonList = eval(imgList); Cloud.PlayPic(imgjsonList); } }) } else { Cloud.PlayPic(imgjsonList); } } }); }, PlayPic: function (Dayun_radar) { //var Dayun_radar = ['201404/20140416/201404161612.jpg', '201404/20140416/201404161542.jpg', '201404/20140416/201404161512.jpg', '201404/20140416/201404161442.jpg']; if (typeof Dayun_radar == 'undefined' || Dayun_radar == null) return; var sd = ''; var ulstart = ''; for (var i = 0, l = Dayun_radar.length; i < l; i++) { var _date = Dayun_radar[i].substr(29, 10).replace(/_/g, "/"); var _time = " " + Dayun_radar[i].substr(40, 5).replace(/_/g, ":"); var cloud_time = new Date(_date + _time); //转换成Data(); cloud_time.setHours(cloud_time.getHours() + 8); sd = cloud_time.Format("MM/dd/yyyy hh:mm") ulcontent += '
  • ' + (sd) + ' (Beijing time)
  • '; } $(".playList").append(ulstart + ulcontent + ulend); time = 2000; var $li = $(".playList li"); var n = count = 0; count = $(".playList li").size() - 1; var time1 = null; Cloud.n = count+1; setImg(0); $(".playPicture").live("click", function () {//播放or暂停 if ($(this).hasClass("stop")) { setStop(); } else { $(this).addClass("stop").attr("src", "/images/stop.jpg").attr("title", "Pause"); time1 = setInterval(function () { changimg(Cloud.n - 1); }, time); } }) //$(".playPicture").click(); $(".palyprev").click(function () {//上一张 changimg(Cloud.n + 1); setStop(); }) $(".palynext").click(function () {//下一张 changimg(Cloud.n - 1); setStop(); }) $(".playList").hover( function () { $(this).find("ul").show() }, function () { $(this).find("ul").hide(); } ); $li.click(function () { var i = $(this).index(); changimg(i); setStop(); }); $(".wxD img.oImg").bind("click", function () { $(".playPicture").click(); }); function changimg(i) { //var i = $(this).index(); if (i < 0) i = count; else if (i > count) i = 0; Cloud.n = i; setImg(Cloud.n); } setStop = function () { clearInterval(time1); $(".playPicture").removeClass("stop").attr("src", "/images/play.jpg").attr("title", "播放"); }; function setImg(index) { var imgsavrPath = Dayun_radar[index]; $(".oImg").attr("src", "" + imgsavrPath); $li.eq(index).addClass("hover").siblings().removeClass("hover"); //sd = year + '年' + month + '月' + day + '日 ' + hourStr + '时' + Dayun_radar[Cloud.n].substr(31, 2) + '分(北京时间)'; var _date = Dayun_radar[index].substr(29, 10).replace(/_/g, "/"); var _time = " " + Dayun_radar[index].substr(40, 5).replace(/_/g, ":"); var cloud_time = new Date(_date + _time); //转换成Data(); cloud_time.setHours(cloud_time.getHours() + 8); sd = cloud_time.Format("MM/dd/yyyy hh:mm (Beijing time)") $(".playList span").html(sd); } } }