$(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) { //var _video = document.getelementbyid("banvideo"); //_video.play(); $('#banner .item').append('
'); $('#banner .slider').slick({ autoplay:true, autoplayspeed:8000, 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 _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'); } }); });