function gotop(){ $(window).scroll(function(e) { if($(window).scrolltop()>100) $(".gotop").fadein(350).css("display","block"); else $(".gotop").fadeout(350).css("display","none"); }); $(".gotop").click(function(e) { $('body,html').animate({scrolltop:0},500); return false; }); }; $(document).ready(function() { //底部固定区域占位 if( $(".fixed-bottom").is(":visible") ){ $("#wrapper").css( "paddingbottom",$(".fixed-bottom").height() ); }else{ } //返回顶部 gotop(); //内容加载后的运动效果 dataanimate(); // 多语言 $('.language ul.sf-menu').superfish({ delay: 500, animation: {opacity:'fast',height:'show'}, speed: 'fast', autoarrows: true, dropshadows: false }); // 导航菜单 $('.main-nav ul.sf-menu').superfish({ delay: 500, animation: {opacity:'fast',height:'show'}, speed: 'fast', autoarrows: true, dropshadows: false }).supposition(); $('.main-nav ul.sf-menu > li').last().addclass('last').end().hover(function(){ $(this).addclass('nav-hover'); },function(){ $(this).removeclass('nav-hover'); }); //菜单动态切换页面效果 $(".main-nav li a, .logo a").click(function(){ if( $(this).attr("target") != "_blank"){ if( $(this).attr("href") != "javascript:;" && $(this).attr("href") != "#" ) return openwork($(this).attr("href")); } }); function openwork(url){ $("#wrapper").css({'-webkit-animation':"bouncein 0.5s .25s ease both",'-moz-animation':'bouncein 1s .25s ease both','animation':'bouncein 0.5s .25s ease both'}); $("body").append("
").css("position","relative"); $(".page-cover").delay(600).animate({"height":$(document).height()},800,null,function(){ location.href = url; }); return false }; //tab $(".tabs-nav").tabs(" > .tabs-panes > div"); //scrollable in tab $(".tabs-nav > li > a").click(function(){ var _tabindex = $(this).parents(".tabs-nav").find("li").index($(this).parent()); if( $(this).parents(".tabs-default").find(".tab-box").eq(_tabindex).find(".scrollable-default").length > 0 ){ $(".scrollable-default").caroufredsel({ width : '100%', infinite : false, circular : false, auto : { pauseonhover: true, timeoutduration:3500 }, swipe : { ontouch:true, onmouse:true }, prev : { button:function() { return $(this).parent().next('.carousel-direction').find(".carousel-prev"); }}, next : { button:function() { return $(this).parent().next('.carousel-direction').find(".carousel-next"); }} }); $(".scrollable-default").parents(".scrollable").css("overflow","visible"); } if( $(this).parents(".tabs-default").find(".tab-box").eq(_tabindex).find(".full-scrollable-default").length > 0 ){ $(".full-scrollable-default").caroufredsel({ infinite : false, circular : false, auto : false, swipe : { ontouch:true, onmouse:true }, responsive : true, items : { visible : { min : 2, max : 8 } }, prev : { button:function() { return $(this).parent().next('.carousel-direction').find(".carousel-prev"); }}, next : { button:function() { return $(this).parent().next('.carousel-direction').find(".carousel-next"); }} }); //重置高度 /*$(".full-scrollable-default").parents('.caroufredsel_wrapper').css({ 'height': ($(".full-scrollable-default").find('li').outerheight()) + 'px' });*/ } if( $(this).parents(".tabs-default").find(".tab-box").eq(_tabindex).find(".pgwslideshow-gallery").length > 0 ){ $('.pgwslideshow-gallery ').find(".ps-next").click(); } }); // accordion $(".accordion").tabs(".accordion .accordion-pane", {tabs: '.accordion-handle', effect: 'slide',initialindex: 0}); $.tools.tabs.addeffect("slide", function(tabindex, done) { this.getpanes().slideup("fast").eq(tabindex).slidedown("fast"); done.call(); }); // tab-round $('.tab-round > .tabs-nav > li > a').click(function(){ $(this).nextall('.line-v').addclass('line-v-c'); $(this).parent('li').siblings('li').find('.line-v').removeclass('line-v-c'); }); //图库切换 $('.pgwslideshow-gallery').pgwslideshow({ mainclassname : 'pgwslideshow-gallery pgwslideshow' }); $('.pgwslideshow-gallery-simple').pgwslideshow({ mainclassname : 'pgwslideshow-gallery-simple pgwslideshow', displaylist : false }); $('.pgwslideshow-gallery-zoom').pgwslideshow({ mainclassname : 'pgwslideshow-gallery-zoom pgwslideshow', displaycontrols : false }); //table //$(".qhd-content table tbody>tr:odd").addclass("odd-row"); //$(".qhd-content table tbody>tr:even").addclass("even-row"); $(".qhd-content table tbody>tr").hover(function(){ $(this).addclass("trhover"); },function(){ $(this).removeclass("trhover"); }); //增加响应式表格外层div $(".qhd-content table").each(function(){ if( !$(this).parent().hasclass("table-responsive") ){ $(this).wrap("
"); } }); //左右悬浮 $(".fixed-left").fixed({halftop : true}); $(".fixed-right").fixed({halftop : true}); // $(".service-close-btn").click(function(){ var servicemax = $(this).parents(".service-max"), servicemin = servicemax.next(".service-min"); servicemin.show(); servicemax.hide(); }); $(".service-open-btn").click(function(){ var servicemax = $(this).prev(".service-max"), fixedelement = $(this).parents(".fixed"); $(this).hide(); servicemax.show(); }); //图标-名称-单列链接 $(".link-fixed-side > ul > li").each(function(){ $(this).hover(function(){ $(this).addclass("active").find(".link-summary").show(); },function(){ $(this).removeclass("active").find(".link-summary").hide(); }); if( $(this).find('a').attr('href').indexof("#popup") != -1 ){ $(this).find('a').addclass('popup-show-btn'); } }); //弹窗视频 $('.fancybox-video-play').fancybox({ 'autoscale' : false, 'transitionin' : 'elastic', 'transitionout' : 'elastic', 'hideonoverlayclick': false, 'centeronscroll' : true, 'overlaycolor' : '#000', 'padding' : '5' }); //弹出窗口区域 $("a").each(function(){ if( typeof($(this).attr('href'))!="undefined" && $(this).attr('href').indexof("#popup") != -1 ){ $(this).addclass('popup-show-btn'); } }); $('.popup-show-btn').click(function(){ $('.popup').show(); $('.popup-overlay').height($(document).height()); $('.popup-content').css({marginleft:-($('.popup-content').outerwidth()/2), margintop:-($('.popup-content').outerheight()/2)}); $('.popup-close-btn').click(function(){ $(this).parents('.popup').hide(); }); return false; }); //设置弹窗视频的宽度 var touchwindowwidth = $(window).width(); if( touchwindowwidth < 1000 ){ $('.article-detail-fancybox').css("width", touchwindowwidth-80); } //移动端 js var ismobile = device.mobile(), istable = device.tablet(), isiphone = device.iphone(), isipad = device.ipad(); if(ismobile || istable || isiphone || isipad){ //移除新窗口打开 $('a').not('[data-mobile-target="_blank"]').removeattr('target'); } }); $(window).load(function() { //scrollable-default $(".scrollable-default").caroufredsel({ width : '100%', infinite : false, //circular : false, auto : { pauseonhover: true, timeoutduration:3500 }, swipe : { ontouch:true, onmouse:true }, prev : { button:function() { return $(this).parent().next('.carousel-direction').find(".carousel-prev"); }}, next : { button:function() { return $(this).parent().next('.carousel-direction').find(".carousel-next"); }} }); $(".scrollable-default").parents(".scrollable").css("overflow","visible"); //full-scrollable-default $(".full-scrollable-default").caroufredsel({ infinite : false, circular : false, auto : false, swipe : { ontouch:true, onmouse:true }, responsive : true, items : { visible : { min : 2, max : 8 } }, prev : { button:function() { return $(this).parent().next('.carousel-direction').find(".carousel-prev"); }}, next : { button:function() { return $(this).parent().next('.carousel-direction').find(".carousel-next"); }} }); //重置高度 $(".full-scrollable-default").parents('.caroufredsel_wrapper').css({ 'height': ($(".full-scrollable-default").find('li').outerheight()) + 'px' }); //不规则多列 if ($('.izotope-container').length) { $('.izotope-container').isotope({ itemselector: '.izotope-item', layoutmode: 'masonry', masonry: { columnwidth: '.grid-sizer' } }); }; }); $(window).bind("load resize", function() { var postlist = $(".post-list"); postlist.each(function(){ var postimg = $(this).find(".post-img"); var posttextbox = $(this).find(".post-text-box"); var posttext = $(this).find(".post-text"); var posttextsummary = $(this).find(".post-text-summary"); var postmaxheight = postimg.eq(0).height(); var summarymaxheight = 0; postimg.each(function(){ postmaxheight = $(this).height() > postmaxheight ? $(this).height() : postmaxheight; }).find("img").height( postmaxheight ); posttextbox.each(function(){ $(this).height( postmaxheight - parseint($(this).css("paddingtop")) - parseint($(this).css("paddingbottom")) ); }); posttextsummary.each(function(){ summarymaxheight = postmaxheight - $(this).prev("h2").height() - parseint($(this).prev("h2").css("marginbottom")) - parseint($(this).parent(".post-text").css("paddingbottom"))*2 - $(this).next(".post-text-detail").height() - 10; if( $(this).height() > summarymaxheight ){ $(this).height( summarymaxheight ); } }); //三列 - 特殊处理第二列 if( $(this).hasclass("post-list-3col") ){ $(this).find(".post-list-item-spec").find(".post-img").css("top", postmaxheight); $(this).find(".post-list-item-spec").find(".post-text-box").css("top", -postmaxheight); } }); });