$(function() { $(".header .nav .nav-li").eq(1).addClass("ac");//导航菜单选中状态 //左下角统计 var dataStatistic = $('#dataStatistic'); var data = []; dataStatistic.next().children().each(function () { data.push(parseInt($(this).text().split(':')[1])); }); var myChart = echarts.init(dataStatistic[0]); var option = { //title: { text: '查看人数', textStyle: { color: '#333', fontSize: 14 } }, grid: { bottom: 20, top: 20, left: 0, right: 0 }, xAxis: { type: 'category', data: data.xAxis, axisTick: { show: false }, axisLine: { lineStyle: { color: "#aaa", type: 'solid' } }, axisLabel: { show: false, interval: 0 } , data: ['导学图总量', '浏览总量', '今日更新导学图'] }, tooltip: { show: true }, yAxis: { show:false }, series: [{ data: data, itemStyle: { color: function (params) { var colorList = ['#8c69dc', '#69dcd5', '#d69b4a']; return colorList[params.dataIndex]; } //['#8c69dc', '#69dcd5','#d69b4a'] }, type: 'bar', barMinHeight: 1, barWidth: 15 , label: {show: true, position: 'top' } }] }; console.log(option); myChart.setOption(option); /*导学图瀑布流 */ var cl = $("#cardlist"), clW = cl.width(), lis = $("#cardlist .list-item"), len = lis.length, lisW = lis.eq(0).outerWidth(true), cHA = [], positionObj = {}, columns = Math.floor(clW / lisW), win = $(window), newLisFlag = true; for (var k = 0; k < columns; k++) { cHA[k] = 0; } var page = 1, size = 12, total =$('#total').val(); var query = location.search.replace('?', ''); (function fn(i) { if (i < lis.length) { var timer = setInterval(function () { var flag = lis.eq(i).find(".img-box img")[0].complete || lis.eq(i).find(".img-box img").attr("data-load"); if (flag) { var lisH = lis.eq(i).outerHeight(true); clearInterval(timer); getMin(cHA); cHA[positionObj.column] += lisH; // console.log(cHA); cl.height(cHA[positionObj.column]); lis.eq(i).css({ "position": "absolute", "left": positionObj.column * lisW, "top": positionObj.top }).fadeIn(200, function () { i++; fn(i); }); } }, 50); } else { win.trigger("scroll"); } })(0); function getMin(arr) { positionObj = {}; positionObj.column = 0; positionObj.top = arr[positionObj.column]; //获取到数组中最小的数据信息; for (var i = 0; i < arr.length; i++) { if (positionObj.top > arr[i]) { positionObj.column = i; positionObj.top = arr[i]; } } // console.log(positionObj); return positionObj; } win.on("scroll", function () { var sct = win.scrollTop(), winH = win.height(); if (newLisFlag && page < total / size) { page++; if (sct + winH > parseFloat($("#cardlist .list-item").eq($("#cardlist .list-item").length - 1).css("top"))) { newLisFlag = false; $.getJSON('PageList', query.length > 0 ? '&p=' + page : 'p=' + page, function (res) { var lisStr = ""; $.each(res.data, function (i, v) { lisStr += '