$(document).ready(function($) { // header $(window).on('scroll', function() { if( $(window).scrollTop() > 100 ){ $("#header").addClass("min"); }else{ $("#header").removeClass("min"); } }); // 搜索 $('.g-search .soBtn').click(function(){ $(this).parents('.g-search').toggleClass('open'); }) $('.g-search').click(function(e){ e.stopPropagation(); }) // 友情链接 $('.f-link .value').click(function(){ $(this).parents('.f-link').toggleClass('open'); }) $('.f-link').click(function(e){ e.stopPropagation(); }) $('body').click(function(){ $('.g-search').removeClass('open'); $('.f-link').removeClass('open'); }) // 二级菜单 function mySnav(elem){ var _winW = $(window).width(); if( $(elem).find('.subBox').length ){ var _left_li = $(elem).offset().left; $(elem).find('.subBox ul').css('left',_left_li); } } $('#nav li').each(function() { var _this = $(this); mySnav(_this); }); // 改变窗口 $(window).resize(function(event) { $('#nav li').each(function() { var _this = $(this); mySnav(_this); }); }); //moblie Nav $('#slideNav').html( $('#nav').html() ); $('#slideNav').find('.subBox ul').unwrap('.subBox'); $("#slideNav").mmenu({ 'navbar' : { 'title' : '' }, "navbars":{ "content": [ "prev", "title" ] }, "extensions": [ "theme-dark" ] }); // banner if ($('#banner .slider').length) { $('#banner .item').append('
'); $('#banner .slider').slick({ autoplay:true, autoplaySpeed:7500, pauseOnHover:false, slidesToShow: 1, speed:1000, dots:true, arrows:true }); $('#banner .slick-arrow').append(''); $('#banner .slider .item.slick-current').addClass('slick-current-page').siblings().removeClass('slick-current-page'); $('#banner .slider').on('afterChange',function(slick, currentSlide){ $('#banner .item.slick-current').addClass('slick-current-page').siblings().removeClass('slick-current-page'); var nums = $('.videos').data('id'); console.log(nums); if(nums){ var _video = document.getElementById("banVideo"); if( currentSlide.currentSlide == 0 ){ _video.play(); _video.currentTime = 0; //$('#banner .slider').slick('slickPause'); }else{ _video.pause(); //$('#banner .slider').slick('slickPlay'); } } }); } // 鼠标按钮 $('.mouseBtn').click(function(){ var _elem = $(this).attr('href'); $('body,html').animate({ scrollTop: $(_elem).offset().top }, 300); return false; }); // 最新新闻 if( $('.g-newSlider').length ){ $('.g-newSlider .slider-for').slick({ fade: true, autoplay:true, autoplaySpeed:5000, pauseOnHover:false, slidesToShow: 1, speed: 50, dots:false, arrows:false, asNavFor: '.g-newSlider .slider-nav', responsive: [ { breakpoint: 750, settings: { dots:true } } ] }); $('.g-newSlider .slider-nav').slick({ slidesToShow: 4, slidesToScroll: 1, asNavFor: '.g-newSlider .slider-for', focusOnSelect: true, speed:1000, dots:false, arrows:false, responsive: [ { breakpoint: 750, settings: { slidesToShow: 3, slidesToScroll: 1 } } ] }); } // 视频播放暂停 function videoplay(id,btn) { var video = document.getElementById(id); var _btn = btn; if ( video.paused ) { video.play(); _btn.stop().animate({ opacity: 0 }, 300); } else { video.pause(); _btn.stop().animate({ opacity: 1 }, 300); } } // 选项卡 $('.TAB li').click(function(){ var _eq = $(this).index(); var _con = $(this).parents('ul').attr('id'); $(this).addClass('active').siblings('li').removeClass('active'); $(_con).eq(_eq).removeClass('dn').show().siblings(_con).addClass('dn').hide(); }); // 图片中心、视频中心 $('.pop-view-button').click(function(){ var _this = $(this); var _url = _this.attr('href'); var _tit = _this.parents('.con').find('.title').text(); var _elem = ''; //默认是视频 var AllImgExt = ['.jpg','.jpeg','.gif','.bmp','.png']; var _filetype = _url.slice( _url.lastIndexOf('.') ); for (var i = 0; i < AllImgExt.length; i++) { if( _filetype == AllImgExt[i] ){ _elem = ''+_tit+''; //检测到图片 } }; $('body').append('

'+_tit+'

'+_elem+'
'); return false; }); $(document).on('click','.pop-view-close',function(){ $('.pop-view-box').remove(); }); // pdf在线阅读 if( $('.JsPDF').length ){ $('body').append(''); }; $('.JsPDF').click(function(){ var _Url = $(this).attr('data-href'); $('#PublishPDF :text').val('/'+_Url); $('#PublishPDF :submit').trigger('click'); }); // 资料下载 function myList(){ if( $('.m-flex-down').length ){ $('.m-flex-down').find('li').unwrap('ul'); var _winW = $(window).width(); var _num = 4; if( $(window).width() > 992 ){ _num = 4; }else if( $(window).width() > 750 ){ _num = 3; // }else if( $(window).width() > 479 ){ }else{ _num = 2; } $('.m-flex-down li').each(function(i) { $('.m-flex-down li').slice(i*_num, i*_num+_num).wrapAll(''); }); if( $('.m-flex-down ul:last() li').length < _num ){ var _length = _num-$('.m-flex-down ul:last() li').length; for (var i = 0; i < _length; i++) { $('.m-flex-down ul:last()').append('
  • '); }; } $(window).resize(function(event) { myList(); }); } } myList(); // 招聘信息 $('.pop-btn').click(function(){ $(this).toggleClass('active').parents('tr').siblings().removeClass('active open').find('.pop-btn').removeClass('active').text('查看详情'); if( $(this).hasClass('active') ){ $(this).text('收起详情'); $(this).parents('tr').addClass('active').next('.pop-box').addClass('open'); }else{ $(this).text('查看详情'); $(this).parents('tr').removeClass('active').next('.pop-box').removeClass('open'); } }); });