$(function(){ // 大事记 if($(window).width()>1025){ $(window).scroll(function () { try{ if ($(window).scrollTop() >= $(".dahis").offset().top-0 && $(window).scrollTop()<=$('.footer').offset().top-0- $(".dahis .left").height()) { $(".dahis .left").stop().animate({ "top": $(window).scrollTop() - $(".dahis").offset().top+100}); } if ($(window).scrollTop()>=$(".dahis .right").height()-300) { $(".dahis .left").addClass("cur") } else{ $(".dahis .left").removeClass("cur") } if ($(window).scrollTop()>=$(".header").height()+$(".site_banner").height()+$(".public_tab").height()) { $(".dahis .left").removeClass("cur2") } else{ $(".dahis .left").addClass("cur2") } } catch (e) { } }) var hisCount = 0; var getHisSize = $(".dahis .left li").size(); $(".dahis .left ul").height($(".dahis .left ul li").height()*getHisSize); $(".dahis .left li").click(function () { var nIndex = $(".dahis .left li").index(this); $(this).removeClass().addClass("on").siblings().removeClass(); if($(this).index()==0){$(".dahis .left .prev i").addClass("disabled");} else if($(this).index()==getHisSize-1){$(".dahis .left .next i").addClass("disabled");} else{ $(".dahis .left .prev i").removeClass("disabled"); $(".dahis .left .next i").removeClass("disabled"); } ajaxFun_now($(this).data("href")); devGetPosition(nIndex); hisCount = nIndex; }) function devGetPosition(nIndex) { var getLeftLiHeight = $(".dahis .left li:eq(0)").height(); var getSize = $(".dahis .left li").size(); var pathCount=$(".prevBox").height()/getLeftLiHeight; //alert(pathCount) if (nIndex > 8&&nIndex < getSize - 2) { $(".dahis .left ul").stop().animate({ "top": nIndex * getLeftLiHeight * -1 + getLeftLiHeight * 8 }); } else if (nIndex >= getSize - 2) { $(".dahis .left ul").stop().animate({ "top": getLeftLiHeight * getSize * -1 + getLeftLiHeight * pathCount }); } else if (nIndex <= 8) { $(".dahis .left ul").stop().animate({ "top": 0 }); } } ajaxFun_now($(".dahis .left li:eq(" + 0 + ")").data("href")); $(".dahis .left .prev i").click(function () { if (hisCount <= 1) { $(".dahis .left .prev i").css("opacity", 1).addClass("disabled"); } else { $(".dahis .left .prev i").css("opacity", 1); $(".dahis .left .next i").css("opacity", 1).removeClass("disabled"); } if (hisCount <= 0) { } else { hisCount--; if ($(".phone_menu").is(":visible")) { //phone $(".dahis .left li:eq(" + hisCount + ")").removeClass().addClass("on").siblings().removeClass(); $(".dahis .left li:eq("+hisCount+")").click(); } else { $(".dahis .left li:eq(" + hisCount + ")").removeClass().addClass("on").siblings().removeClass(); $(".dahis .left li:eq("+hisCount+")").click(); } } }) $(".dahis .left .next i").click(function () { if (hisCount >= getHisSize - 2) { $(".dahis .left .next i").css("opacity", 1).addClass("disabled"); } else { $(".dahis .left .prev i").css("opacity", 1).removeClass("disabled"); $(".dahis .left .next i").css("opacity", 1); } if (hisCount >= getHisSize - 1) { } else { hisCount++; if ($(".phone_menu").is(":visible")) { //phone $(".dahis .left li:eq(" + hisCount + ")").removeClass().addClass("on").siblings().removeClass(); $(".dahis .left li:eq("+hisCount+")").click(); } else { $(".dahis .left li:eq(" + hisCount + ")").removeClass().addClass("on").siblings().removeClass(); $(".dahis .left li:eq("+hisCount+")").click(); } } }) }else{ var winw,doortabWidth,doortabLength,doortabIndex,doorvisiLength; /*.....................................................................start*/ function doortabInt(){ if (winw>1025) { doorvisiLength=9; } else if(winw<=1025&&winw>767){ doorvisiLength=5; } else{ doorvisiLength=3; } doortabLength=$('.dahis .left li').length; doortabWidth=$('.dahis .left').width()/doorvisiLength; doortabIndex=0; $('.dahis .left .next').addClass('on'); doorChange=Math.floor(doorvisiLength/2); $('.dahis .left li').width(doortabWidth); if (doortabLengthdoortabLength-1){ doortabIndex=doortabLength-1; } if(doortabIndex<0){ doortabIndex=0; } if (doortabLength>doorvisiLength) { if (doortabIndex>=doorChange&&doortabIndex=doortabLength-doorChange){ $('.dahis .left ul').stop().animate({'left':-doortabWidth*(doortabLength-doorvisiLength)},300) } else{ $('.dahis .left ul').stop().animate({'left':0},300) } } $('.dahis .left li').eq(doortabIndex).addClass('on').siblings().removeClass('on'); if (doortabIndex<1) { $('.dahis .left .prev').removeClass('on'); } if (doortabIndex>doortabLength-2) { $('.dahis .left .next').removeClass('on'); } } $(document).on('click','.dahis .left .prev',function(){ doortabIndex--; doortabSlide(); $(".dahis .left li.on").click() }) $(document).on('click','.dahis .left .next',function(){ doortabIndex++; doortabSlide(); $(".dahis .left li.on").click() }) $(document).on('click','.dahis .left li',function(e){ if(window.event){ //IE中阻止函数器默认动作的方式 window.event.returnValue = false; } else{ //阻止默认浏览器动作(W3C) e.preventDefault(); } doortabIndex=$(this).index(); doortabSlide(); ajaxFun_now($(this).data("href")); }) /*............................................................end*/ $(".dahis .left li").eq(0).click() winw=$(window).width(); doortabInt(); $(window).resize(function() { $(".dahis .left li").eq(0).click(); winw=$(window).width(); doortabInt(); }); } }) function ajaxFun_now(url) { $.ajax({ url: url, type: "GET", success: function (msg) { $('.dahis .right').html(msg); $(document).ready(function(){ var $resourceTypeList = $('.resource-type-list');//最外层元素名 function item_masonry(){ $resourceTypeList.imagesLoaded(function () { $resourceTypeList.masonry({ itemSelector: '.panel',//列表元素类名 }); }); // $resourceTypeList.masonry('reload'); } item_masonry(); $(window).resize(function() { item_masonry(); }); }) } }); } $(function(){ if($(window).width()>1025){ if($(".dahis .left .prevBox ul li").length<9){ $(".dahis").addClass("ultop") } } })