import '../css/bootstrap.less'; import 'bootstrap/dist/js/bootstrap.js'; import '../css/newMenu/public.css'; import '../css/newMenu/header.css'; import '../css/index_home.css'; import '../css/indexNew.css'; import './public.js'; import './jquery-2.1.0.js'; (function(){ //搜索框上面栏目的选择 $(".indexSeach_one>ul>li").click(function(){ $(this).parent().children().removeClass("indexActive"); $(this).addClass("indexActive"); }) //搜索功能 $(".indexImg1").click(function(){ var seachon=$(".indexSeach_one>ul>li.indexActive").index(); var key=$("#int").val(); localStorage.setItem("indexKeyWord",key); switch(seachon){ case 0:window.open(globalConfig.context + '/portal/technologyTrading/achievement.html');break; case 1:window.open(globalConfig.context + '/portal/technologyTrading/demand.html');break; case 2:window.open(globalConfig.context + '/portal/technologyTrading/achievement.html');break; case 3:window.open(globalConfig.context + '/portal/thinkTank/policyList.html');break; case 4:window.open(globalConfig.context + '/portal/thinkTank/index.html#zizone');break; case 5:break; } }) //申请会员 $(".indexImg2").click(function(){ $(".ret_top>li:nth-child(1)").click(); }) //搜索栏下面的点击,登录判断 $(".seachCont1>div:nth-child(4)>a").click(function(){ var islogin=$("#isLogin").attr("islogin"); if(islogin=="true"){ $(".head_login").click(); }else if(islogin=="false"){ $(this).attr("href","/user/account/demand.html#techDemand"); $(this).click(); } }) $(".seachCont1>div:nth-child(5)>a").click(function(){ var islogin=$("#isLogin").attr("islogin"); if(islogin=="true"){ $(".head_login").click(); }else if(islogin=="false"){ $(this).attr("href","/user/account/achievement.html#techAchievement"); $(this).click(); } }) //搜索框下面的页面链接点击 $(".seachMore").click(function(){ if($(this).parent().children("#seachCont").children().attr("clicka")=="0"){ $(this).parent().children("#seachCont").children().animate({"left":"-138px"},"slow").attr("clicka","1"); }else if($(this).parent().children("#seachCont").children().attr("clicka")=="1"){ $(this).parent().children("#seachCont").children().animate({"left":"0px"},"slow").attr("clicka","0"); } }) //成果需求切换 $(".indexGroom_table>div").click(function(){ $(this).parent().children().removeClass("indexGroom_active"); $(this).addClass("indexGroom_active"); console.log($(this).html()); if($(this).html()=="成果"){ $(".chengguo").css("display","block"); $(".xuqiu").css("display","none"); }else if($(this).html()=="需求"){ $(".chengguo").css("display","none"); $(".xuqiu").css("display","block"); } }) //滚动导航 $(window).scroll(function(){ var scrolltop=$(document).scrollTop(); if(scrolltop>500){ $('.topNav').addClass('navFix') }else{ $('.topNav').removeClass('navFix'); } }); //轮播图的开始 var img_length=$(".ct-img-big").children("li").length-2; var smallhtml=""; for(var i=1;i<=img_length;i++){ smallhtml+="
" } $(".ct-img-small").html(smallhtml); var ctwidth=$('.ct-img-small').width(); $('.ct-img-small').css({marginLeft:-ctwidth/2}); $(".ct-img-small").children().eq(0).addClass("active"); var $imgBig=$('.ct-img-big'), $btnNext=$('.btn-next'), $btnPre=$('.btn-pre'), $CT = $('.carouselt'), $imgSmall=$('.ct-img-small'); var $imgWidth=$imgBig.find('li').width();//获取图片的宽度; var $imgLength=$imgBig.children().length;//获取克隆前的图片的长度; // 拷贝第一张和最后一张;把最后一张图放在最前面;把最前面的图放在最后; var $firstImg=$imgBig.find('li').first(), $lastImg=$imgBig.find('li').last(); $imgBig.prepend($lastImg.clone()); $imgBig.append($firstImg.clone()); //设置imgBig clone后的宽度 $imgBig.css("width", $imgWidth*$imgBig.children().length+"px")//这时的个数是添加完以后的个数 $imgBig.css({'left':'-='+$imgWidth+'px'})//把第一张图放入可视区 var pageIndex = 0 ; //img的下标; var isAnimate = false//防止重复点击 上锁 $btnNext.on('click',function(e){ e.preventDefault(); playNext(); setTimeout(function(){ },1500) }); $btnPre.on('click',function(e){ e.preventDefault(); playPre(); setTimeout(function(){ },1500) }); $imgSmall.find('li').on('click',function(){ var smallIdx= $(this).index(); if(smallIdx>pageIndex){ playNext(smallIdx-pageIndex) } else if(smallIdx