var Virtual = { //图片列表 picList: function (sTime,eTime) { var container = $(".thumb");//数据加载容器 /*数据日期筛选*/ //var nowData = new Date(); //nowData.setMonth(nowData.getMonth()-3) //var _smonth = nowData.getMonth() - 2; //_smonth=_smonth>9?_smonth:"0"+_smonth; //var _emonth = nowData.getMonth() +1; //_emonth=_emonth>9?_emonth:"0"+_emonth; //if (sTime == null || undefined == sTime) // sTime = nowData.getFullYear().toString().substring(2, 4) + _smonth; //if (eTime == null || undefined == eTime) // eTime = nowData.getFullYear().toString().substring(2, 4) + _emonth; //sTime = parseInt(sTime); //eTime = parseInt(eTime); /*数据日期筛选end*/ var nowData = new Date(); nowData.setMonth(nowData.getMonth() - 1); var sTime = parseInt(nowData.Format("yyMM")); var endData = new Date(); var eTime = parseInt(endData.Format("yyMM")); $.getJSON("/Virtual/VirtualList.js?t=" + Math.random(), function (json) { if (json) { container.empty(); //图片缓存 json.sort(getSortFun('desc', 'name')); function getSortFun(order, sortBy) { var ordAlpah = (order == 'asc') ? '>' : '<'; var sortFun = new Function('a', 'b', 'return a.' + sortBy + ordAlpah + 'b.' + sortBy + '?1:-1'); return sortFun; } $.each(json, function (index, content) { var pic_data = content.name.substring(2, 6);//图片日期 pic_data = parseInt(pic_data); if (pic_data >= sTime && pic_data <= eTime) { $("
  • \""" + content["name"].substring(4, 8) + "
  • ").appendTo(container); } }) $("img.lazy").lazyload({ placeholder: "/images/grey.gif", effect: "fadeIn", threshold: 200 }); $('ul.thumb li').Zoomer({ speedView: 200, speedRemove: 400, altAnim: false, speedTitle: 400, debug: false }); $(".group").colorbox({ rel: "group", maxWidth: "95%", maxHeight: "90%", current: "{current} / {total}" }); /*---2016-11-21---START-----*/ if (location.pathname == "/wap/Virtual.aspx") { $(".cj_pic ul li").height($(".cj_pic ul li").width()).css("line-height", $(".cj_pic ul li").width() + "px"); } } }) // Virtual.masonry(); }, //瀑布流 masonry: function () { var $container = $('#container'); $container.imagesLoaded(function () { $container.masonry({ itemSelector: '.box', columnWidth: 5 //每两列之间的间隙为5像素 }); }); }, //点收藏 picLike: function (obj,e) { var stat = obj.attr("stat"); if (stat != undefined || stat == 1) return; obj.css("background-image", "url(/images/dT_2.png)"); var like = parseInt(obj.text())+1; obj.text(like++).attr("stat", "1"); Virtual.anp(e) }, //冒泡 anp:function(e){ var $i=$("").text("+1"); var x=e.pageX,y=e.pageY; $i.css({top:y-20,left:x,position:"absolute",color:"#E94F06"}); $("body").append($i); $i.animate({top:y-180,opacity:0,"font-size":"1.4em"},1500,function(){ $i.remove(); }); e.stopPropagation(); } }