$(function(){ var index = { init:function(){ this.bindEvent(); this.layuiBanner(); this.getNews(); }, bindEvent:function(){ $(".mainrow").mouseenter(function(){ var index = $(this).index(); $(this).find(".sil").css({"background":'url(static/images/index/main'+(index+1)+'-hover.png) no-repeat center center'}); $(this).find(".mainleft").css({"background":'#fff'}) $(this).find(".mianright").css({"background":'#999',"color":"#fff"}) }) $(".mainrow").mouseleave(function(){ var index = $(this).index(); $(this).find(".sil").css({"background":'url(static/images/index/main'+(index+1)+'.png) no-repeat center center'}) $(this).find(".mainleft").css({"background":'#035081'}) $(this).find(".mianright").css({"background":'#fff',"color":"#000"}) }); $(".newsItem").on("click",".item",function(){ console.log($(this).attr("data-id")) var id = $(this).attr("data-id") if(id != ""){ localStorage.setItem("newsId",$(this).attr("data-id")); location.href="newsDetail.html" } }) }, getNews:function(n){ var that=this; if(n!=null){ n=n }else{ n=1 } var url=yewuxitong_path+"/news/getPlatformNewsList"; var data={ "merchantId":"6400a24e96f44f799f88093486ef7876", "languageType":"CN", "page":n, "pageSize":"1000" // "keyword":"1" }; function callBack(res){ console.log(res); if(res.content == null || res.content == "" || res.content == undefined){ html+='