From 5528d168f3beb26b1a72d49c153df6af5ad80943 Mon Sep 17 00:00:00 2001 From: liudan <18634735655@163.com> Date: Thu, 22 Dec 2022 23:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/index.css | 3 +-- js/index.js | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/css/index.css b/css/index.css index 48ac9f8..4b1f7f8 100644 --- a/css/index.css +++ b/css/index.css @@ -721,8 +721,7 @@ a:active{ margin-top:30px; } .selectContainer{ - text-align: left; - + text-align: right; } .selectContainer>.select{ height: 49px; diff --git a/js/index.js b/js/index.js index 555180a..0ee7c00 100644 --- a/js/index.js +++ b/js/index.js @@ -301,24 +301,30 @@ $(function(){ url: 'https://suzhou.njrenzhou.cn/api.php/busmap/starProject', dataType: 'json', data:{ - limit:30 + limit:100000 }, success: function (res) { - - let data = res.data.data - let firstList = data.slice(0,30); - let secondList = data.slice(30,30); - let thirdList = data.slice(31,30) - - - + console.log(Math.floor(res.data.total/3)) + let num = Math.floor(res.data.total/3) + let data = res.data.data + let firstList = data.slice(0,num); + let secondList = data.slice(num,num*2); + let thirdList = data.slice(num*2,num*3) let html='' - res.data.data.forEach((item,index)=>{ + let html1='' + let html2='' + firstList.forEach((item,index)=>{ html+=`
  • ` }) + secondList.forEach((item,index)=>{ + html1+=`
  • ` + }) + thirdList.forEach((item,index)=>{ + html2+=`
  • ` + }) $('.g1 ul').append(html) - $('.g2 ul').append(html) - $('.g3 ul').append(html) + $('.g2 ul').append(html1) + $('.g3 ul').append(html2) groupSlide() // console.log(firstList,secondList,thirdList) }