var winw,doortabWidth,doortabLength,doortabIndex,doorvisiLength; /*.....................................................................start*/ function doortabInt(){ if (winw>1024) { doorvisiLength=8; } else if(winw<1024&&winw>767){ doorvisiLength=6; } else{ doorvisiLength=3; } doortabLength=$('.door_tab li').length; doortabWidth=$('.door_tab').width()/doorvisiLength; doortabIndex=0; $('.brief_top .but a.next').addClass('on'); doorChange=Math.floor(doorvisiLength/2); $('.door_tab li').width(doortabWidth); if (doortabLengthdoortabLength-1){ doortabIndex=doortabLength-1; } if(doortabIndex<0){ doortabIndex=0; } if (doortabLength>doorvisiLength) { if (doortabIndex>=doorChange&&doortabIndex=doortabLength-doorChange){ $('.door_tab ul').stop().animate({'left':-doortabWidth*(doortabLength-doorvisiLength)},300) } else{ $('.door_tab ul').stop().animate({'left':0},300) } } $('.door_tab li').eq(doortabIndex).addClass('on').siblings().removeClass('on'); //添加请求代码 $(".rylmli").each(function(){ if($(this).hasClass("on")){ querydetail($(this).attr("data-val")); } }); var pageIndex=$('.door_tab li').eq(doortabIndex).find('a'); doortabAjax(pageIndex); if (doortabIndex<1) { $('.brief_top .but a.prev').removeClass('on'); } if (doortabIndex>doortabLength-2) { $('.brief_top .but a.next').removeClass('on'); } } function doortabAjax(pageIndex){ var url=pageIndex.attr('href') if (url==null)return false; $.ajax({ type:"GET", url:url, success:function(msg){ $('.brief_block').html(msg) // imgratio(); } }) } $(document).on('click','.brief_top .but a.prev',function(){ doortabIndex--; doortabSlide(); }) $(document).on('click','.brief_top .but a.next',function(){ doortabIndex++; doortabSlide(); }) $(document).on('click','.door_tab li',function(e){ if(window.event){ //IE中阻止函数器默认动作的方式 window.event.returnValue = false; } else{ //阻止默认浏览器动作(W3C) e.preventDefault(); } doortabIndex=$(this).index(); doortabSlide(); }) /*............................................................end*/ $(function(){ $(".door_tab li").eq(0).click() winw=$(window).width(); doortabInt(); }) $(window).resize(function() { $(".door_tab li").eq(0).click() winw=$(window).width(); doortabInt(); }); $(function(){ if(winw>1024){ var nIndexCount=0; $(".serbox_detail_scroll ul li").eq(0).addClass("active"); $(".serbox_detail_scroll li").unbind("click"); $(".serbox_detail_scroll ul li").width("10%"); $(".serbox_detail_scroll ul li.active").width("58%"); $(".serbox_detail_scroll ul li").height("384px"); //$(".serbox_detail_scroll ul li img").css({"height":"427px","width":"100%"}); $(".serbox_detail_scroll li").hover(function(){ var nIndex=$(".serbox_detail_scroll li").index(this); if(nIndexCount==nIndex){ }else{ $(this).stop().animate({"width":"58%"},"slow").siblings().stop().animate({"width":"10%"},"slow"); $(this).find(".serbox_cover").hide(); $(this).siblings().find(".serbox_cover").show(); $(".service_box ul li:eq("+nIndex+")").removeClass().addClass("active").siblings().removeClass(); $(this).removeClass().addClass("active").siblings().removeClass(); nIndexCount=nIndex; } }) }else if(winw<1024&&winw>767){ var mySwiper = new Swiper('.brief_slider .swiper-container',{ loop:true }) $('.brief_slider .arrow-left').on('click', function(e){ e.preventDefault() mySwiper.swipePrev() }) $('.brief_slider .arrow-right').on('click', function(e){ e.preventDefault() mySwiper.swipeNext() }) } $(window).resize(); })