var curIndex = 0;//当前大屏图片次序 var time = 800;//大屏图片切换飞入时间 var slideTime = 5000;//大屏切换时间(毫秒) var int = setInterval("autoSlide()", slideTime);//初始化大屏轮播(自动) $(document).ready(function() { //初始化菜单 getHeaderMenuData(); //初始化190aa踢球者篮球比分动态 getNews("CDY"); //初始化页脚 getFooterMenu(); //获取页脚信息 getFooterInfo(); //事件绑定 eventAction(); }) function eventAction() { //初始化轮播大图下面的点击事件 $("#banner_ctr > ul > li").click(function () {//获取li元素的点击事件 show($(this).index());//根据li的位置展示 window.clearInterval(int); int = setInterval("autoSlide()", slideTime);// slideTime也是延迟时间 时间的限制var slideTime = 5000;1秒 }); //产品方案页面事件 $(".y-row ul li").hover(function() { $(this).addClass("active").siblings().removeClass("active"); }); $(".tabs ul[role='tablist'] li").click(function() { $(this).addClass("active").siblings().removeClass("active"); $(".tabs .tab-content > div").removeClass("active"); $(".tabs .tab-content > div:eq(" + $(this).index() + ")").addClass("active"); }); //190aa踢球者篮球比分动态和媒体报道切换 $("#indexPage >ul >li").bind("click",function(){ if($(this).hasClass("cur"))return; $(this).addClass("cur").siblings().removeClass("cur"); if($(this).attr("id")=="panLi"){ getNews("CDY"); }else{ getNews("MEDIA"); } }); } //轮播大图滑动 function autoSlide() { //curIndex是全局变量 size是图片的位置()1、2、3) curIndex + 1 >= $("#banner_img>li").length ? curIndex = -1 : false; show(curIndex + 1); } function show(index) { $("#banner_ctr ul li").removeClass('selected');//.removeClass('selected')是除去"#banner_ctr ul li" 下的selected,selected是一种样式 $("#banner_ctr ul li").eq(index).addClass('selected');//在"#banner_ctr ul li"下等于index的增加selected样式 $("#banner_img>li").eq(curIndex).stop(false, true).fadeOut(time);//设置图片的全局变量(curIndex是全局变量) if($("#banner_img>li").eq(curIndex).attr("type") == "0"){//设置一些动画样式 图片切换的样式 animate是一种动画效果的属性 $(".item6_font1").animate({ top: "-110px" }, time); $(".item6_font2").animate({ bottom: "-45px" }, time); $(".item6_font3").animate({ right: "-60%" }, time); } if($("#banner_img>li").eq(curIndex).attr("type") == "1"){ $(".item2_font").animate({ right: "-500px" }, time); $(".item2_font2").animate({ left: "-762px" }, time); } if($("#banner_img>li").eq(curIndex).attr("type") == "2"){ $(".item5_pic").animate({ top: "270px" }, time); } setTimeout(function () {//setTimeout是延迟函数,延迟的时间是200毫秒 $("#banner_img>li").eq(index).stop(false, true).fadeIn(time); if($("#banner_img>li").eq(index).attr("type") == "0"){ $(".item6_font1").animate({ top: "120px" }, time); $(".item6_font2").animate({ bottom: "284px" }, time); $(".item6_font3").animate({ right: "6%" }, time); } if($("#banner_img>li").eq(index).attr("type") == "2"){ $(".item3_font1").animate({ top: "178px" }, time); $(".item3_font2").animate({ bottom: "240px" }, time); $(".item3_font3").animate({ right: "185px" }, time); } if($("#banner_img>li").eq(index).attr("type") == "1"){ $(".item2_font").animate({ right: "8%" }, time); $(".item2_font2").animate({ left: "16%" }, time); } if($("#banner_img>li").eq(index).attr("type") == "3"){ $(".item5_pic").animate({ top: "270px" }, time); } }, 200);//设置 延迟时间 curIndex = index; } //初始化190aa踢球者篮球比分动态 function getNews(newsType){ $.ajax({ type : 'post', url : rootPath + '/index/getNews', data : { type: newsType }, success : function(data) { initNews(data); }, error : function(XMLHttpRequest, textStatus, errorThrown) { if(errorThrown == "Forbidden" || XMLHttpRequest.status == "403" || XMLHttpRequest.status == "404"){ layer.alert(ForbiddenMsg,{icon: 7},function(){ window.location.href = rootPath; }); }else{ layer.alert(errorThrown,{icon: 7},function(){ window.location.href = rootPath; }); } } }); } function initNews(data){ var inner = ""; if(data.top == "N"){ inner += "
"+ ""+getDayMonth(data.list[i].F_PRESS_TIME)+""+ ""+getYear(data.list[i].F_PRESS_TIME)+""+ "
"+ ""+ ""+getDayMonth(data.list[i].F_PRESS_TIME)+""+ ""+getYear(data.list[i].F_PRESS_TIME)+""+ "
"+ ""+data.list[i].F_TITLE+""+ ""+ "详情>>"+ ""+ ""+ ""+getDayMonth(data.list[i].F_PRESS_TIME)+""+ ""+getYear(data.list[i].F_PRESS_TIME)+""+ "
"+ ""+ ""+getDayMonth(data.list[i].F_PRESS_TIME)+""+ ""+getYear(data.list[i].F_PRESS_TIME)+""+ "
"+ ""+data.list[i].F_TITLE+""+ ""+ "详情>>"+ ""+ "