(function($){ /*滚动显示动画初始化*/ if (!(/msie [6|7|8|9]/i.test(navigator.useragent))){ var wow = new wow({ boxclass: 'wow', animateclass: 'animated', offset: 0, mobile: true, live: true }); wow.init(); } /*头部样式变换*/ if($(document).scrolltop() != 0) { $('#header').attr('class','header_hover'); } $(window).scroll(function() { if($(document).scrolltop() == 0) { $('#header').attr('class','header'); }else{ if(!$('#header').hasclass('header_hover')){ $('#header').attr('class','header_hover'); } } }); /*项目简介展示*/ $('#case_xl').click(function(){ if($(this).is('.on')){ $(this).removeclass('on'); $('#case_txt').removeclass('on'); }else{ $(this).addclass('on'); $('#case_txt').addclass('on'); } }); })(jquery); if ($('.swiper-cases').size() > 0) { /*案例切换*/ var cases = new swiper('.swiper-cases', { pagination: '.clients_pages', paginationclickable: true, loop: true, speed: 500, autoplay: 4500, spacebetween: 30 }); } if ($('.swiper-latest').size() > 0) { var latest = new swiper('.swiper-latest', { nextbutton: '.latest-next', prevbutton: '.latest-prev', spacebetween: 20, slidesperview: 3, lazyloading: true, autoheight: true, //loop: true }); } if ($('.swiper-mobile').size() > 0) { var mobile = new swiper('.swiper-mobile', { pagination: '.swiper-pages', paginationclickable: true, nextbutton: '.mobile-next', prevbutton: '.mobile-prev' }); } //if ($('.gallery-top').size() > 0) { // var gallerytop = new swiper('.gallery-top', { // nextbutton: '.gallery-next', // prevbutton: '.gallery-prev', // spacebetween: 10, // }); //} if ($('.gallery-thumbs').size() > 0) { var gallerythumbs = new swiper('.gallery-thumbs', { spacebetween: 10, centeredslides: true, slidesperview: 'auto', slidetoclickedslide: true, nextbutton: '.thumbs-next', prevbutton: '.thumbs-prev', onslidechangestart: function (swiper) { var src = $('.thumbs').find('.swiper-slide').eq(swiper.activeindex).find('img').attr('src'); $('.gallery-top').find('img').attr('src', src); } }); //gallerytop.params.control = gallerythumbs; //gallerythumbs.params.control = gallerytop; } if ($('.swiper-container-h').size() > 0) { var swiperh = new swiper('.swiper-container-h', { direction: 'vertical', pagination: '.swiper-pagination-h', paginationclickable: true, slidesperview: 1, speed: 500, keyboardcontrol: true, height: window.innerheight, mousewheelcontrol: true, oninit: function (swiper) { //swiper2.x的初始化是onfirstinit swiperanimatecache(swiper); //隐藏动画元素 swiperanimate(swiper); //初始化完成开始动画 }, onslidechangeend: function (swiper) { swiperanimate(swiper); //每个slide切换结束时也运行当前slide动画 } }); } function setinitialslide(index){ swiperh.slideto(index,500); } //调整字体大小 function changefontsize(id, size) { $('#' + id + " p,td").css("font-size", size + 'px'); } //div层随屏幕滚动 //层样式需设置绝对定位position:absolute; $(document).ready(function () { if ($("#online").size() > 0) { mousescrollfun('online'); } }); function mousescrollfun(id) { var menuyloc = $("#" + id).offset().top; $(window).scroll(function () { if ($(window).scrolltop() > menuyloc) { $("#" + id).css("position", "absolute"); var offsettop = $(window).scrolltop() + 100 + "px"; $("#" + id).animate({ top: offsettop }, { duration: 100, queue: false }); } else { $("#" + id).animate({ top: 100 }, { duration: 100, queue: false }); } }); } function closefloatwindow() { $("#online_right").hide(); $("#online").css("width", "32px"); //$("#smallfloatwindow").show(); } function showfloatwindow() { //$("#smallfloatwindow").hide(); if ($("#online_right").css("display") == "none") { $("#online_right").show(); $("#online").css("width", "151px"); } else { closefloatwindow(); } } function backtotop() { $(document).scrolltop(0); }