/**
* 通用模块
*/
var $win = $(window), // 获取窗口对象 BOM
$doc = $(document), // 获取文档对象 DOM
$body = $('body', $doc), // 获取文档主体body
winW = $win.width(); // 获取当前窗口的宽度(不包含滚动条)
$(window).resize(function() { // 窗口大小改变时触发
winW = $win.width(); // 更新窗口宽度
});
/**
* 图片懒加载
*/
$(function(){
$('img.lazy').lazyload({
effect: "fadeIn",
threshold: 400
});
// if (!$.fn.lazyload) return;
// $("img.lazy", $body).lazyload({
// effect: "fadeIn",
// threshold: 200,
// failure_limit: 0
// });
});
// 导航固定
$(function(){
$win.on('scroll', function(){
var t = $(this).scrollTop(); // 获取滚动条距离顶部位置
if (t > 10) {
$('.header').addClass('fixed');
$('.header-button').addClass('fixed');
$('.header .search .page').fadeOut(200);
} else {
$('.header').removeClass('fixed');
$('.header-button').removeClass('fixed');
}
});
$('.header-button').on('mouseenter',function(){
$('.header').addClass('fixed');
$('.header-button').addClass('fixed');
});
});
// 导航下划线
$(function(){
$('.header .nav .link>li').on('mouseenter', function(){
$('.header .search .page').fadeOut(200);
$(this).parent().children('li').removeClass('active');
$(this).addClass('active');
});
$('.header .nav .link').on('mouseleave', function(){
$(this).children('li').removeClass('active');
$(this).children('.cur').addClass('active');
});
});
// 二级栏目
$(function(){
if (winW < 1200) return false;
$('.header .nav .link>li').on('mouseenter', function(){
$(this).children('.menu').stop().slideDown(200);
}).on('mouseleave', function(){
$(this).children('.menu').stop().slideUp(200);
});
});
// 导航按钮
$(function(){
$('.header .button>div').on('click', function(){
$('.header .search .page').fadeOut(200);
$(this).toggleClass('active');
$('.header .nav').toggleClass('active');
});
});
// 手机导航
$(function(){
if (winW > 1200) return false;
$('.header .nav .link>li.more>a').on('click', function(event){
event.stopPropagation();
event.preventDefault();
});
$('.header .nav .link').on('mouseenter','>li.more.active', function(){
$(this).children('.menu').stop().fadeIn(200);
}).on('mouseleave','>li.more.active', function(){
$(this).children('.menu').stop().fadeOut(200);
});
});
// 搜索 search
$(function(){
$('.header .search').on('click','p', function(){
$(this).parent().children('.page').stop().fadeIn(200);
$(this).parent().find('.page input').focus();
});
$('.header .search .page .close').on('click', function(){
$(this).parent().parent().fadeOut(200);
});
});
// 返回顶部
$(function(){
$win.on('scroll', function(){
var t = $(this).scrollTop();
if (t > 1000) {
$('.back-top').addClass('active');
} else {
$('.back-top').removeClass('active');
}
});
$('.backtop').on('click', function(){
$('html, body').animate({ scrollTop: 0 }, 400);
});
});
// 数字滚动
$(function(){
$('.counter').countUp();
});
// 锚点滑动
$(function(){
$(".smooth").click(function() {
var href = $(this).attr("href");
var pos = $(href).offset().top - 0;
$("html,body").animate({ scrollTop: pos }, 1000);
return false;
});
});
// 动画定位
$(function(){
var wow = new WOW({
boxClass: 'wow', // 需要执行动画元素的class,默认:wow
animateClass: 'animate__animated', // animation.css动画的class,默认:animated
});
wow.init();
});
// 弹窗
$(function(){
$('[data-fancybox]').fancybox({
beforeShow: function() {
$('.caption--image').remove();
},
afterShow: function() {
var caption = $(".fancybox-caption"),
innerCaption = caption.clone().addClass('caption--image');
$(".fancybox-slide--current .fancybox-content").append(innerCaption);
caption.not('.caption--image').addClass('caption--bottom');
}
});
});
// 首页 banner
$(function(){
$('.index-banner').css('height','auto');
var indexBanner = $('.index-slick').slick({
autoplay: false, // 是否自动播放
autoplaySpeed: 3000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: true, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 1, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: true, // 是否显示圆点指示器
arrows: false, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: true, //启用选定元素的焦点(单击)
infinite: true, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 1, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 1, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
pauseOnHover: false,
responsive: [ // 响应式
{
breakpoint: 768,
settings: {
slidesToShow: 1
}
}
],
});
// banner 右侧导航列表
indexBanner.on('beforeChange', function(event, slick, currentSlide, nextSlide){
var index = nextSlide + 1;
$('.index-banner .r-list li').removeClass('active');
$('.index-banner .r-list li:nth-child('+index+')').addClass('active');
});
$('.index-banner .r-list li').on('click', function(){
var index = $(this).index();
indexBanner.slick('slickGoTo', index);
});
// banner图只有一张隐藏圆点指示器
var bannerNum = $('.index-slick .slick-slide').length;
if (bannerNum <= 1) {
$('.slick .slick-dots').hide();
}
var bannerVideo = document.getElementById('banner-video');
function init() {
if (bannerVideo) {
indexBanner.addClass('hide-dots');
// onloadedmetadata js事件,视频元数据加载后触发
bannerVideo.onloadedmetadata = function(){
// 视频播放结束
bannerVideo.addEventListener('ended', function(){
indexBanner.slick('slickNext');
});
}
} else {
indexBanner.slick('slickPlay'); // 开始自动播放
}
}
init();
if (!bannerVideo) return;
indexBanner.on('beforeChange', function(event, slick, currentSlide, nextSlide){
if (winW < 767) return;
if (nextSlide == 0) {
indexBanner.addClass('hide-dots');
indexBanner.slick('slickPause');
bannerVideo.play();
} else {
indexBanner.removeClass('hide-dots');
indexBanner.slick('slickPlay');
bannerVideo.pause();
}
});
// https://gitcode.gitcode.host/docs-cn/video.js-docs-cn/index.html
var options = {
autoplay: true, // 是否自动播放
muted: true, // 是否静音
loop: false, // 是否循环播放
controls: false, // 是否显示底部控制栏
preload: 'auto', // auto自动预加载,metadata仅加载视频元数据,none不加载任何数据
// poster: '../images/index-banner-1.jpg', // 播放前显示的图像
aspectRatio: '1920:937', // 设置播放器为流体模式,动态计算播放器大小
}
var player = videojs('banner-video', options, function(){
// this.play();
bannerVideo.play();
this.on('ended', function(){
console.log('end');
indexBanner.slick('slickNext');
});
});
});
// 首页-产业发展
$(function(){
$('.index-develop .con .list').on('mouseenter', function(){
$(this).parent().children('.list').removeClass('active');
$(this).addClass('active');
});
});
// 首页-生产布局
$(function(){
var layoutSlick = $('.layout-slick').slick({
autoplay: false, // 是否自动播放
autoplaySpeed: 5000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: false, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 6.5, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: false, // 是否显示圆点指示器
arrows: false, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: true, //启用选定元素的焦点(单击)
infinite: false, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 1, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 1, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
pauseOnHover: false,
responsive: [ // 响应式
{
breakpoint: 1440,
settings: {
slidesToShow: 5.5
}
},
{
breakpoint: 1280,
settings: {
slidesToShow: 4.5
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 3.5
}
},
{
breakpoint: 767,
settings: {
slidesToShow: 2
}
},
],
});
$('.index-layout .bottom .con').on('mouseenter', function(){
$(this).parent().children('.con').removeClass('active');
$(this).addClass('active');
});
$('.index-layout .bottom .con .list .slick-slide').on('mouseenter', function(){
var index = $(this).index()+1;
$(this).parent().children('.slick-slide').removeClass('active');
$(this).addClass('active');
});
$('.index-layout .bottom .con:nth-child(1) .list .slick-slide').on('mouseenter', function(){
var index = $(this).index()+1;
$('.index-layout .map .yellow span').removeClass('active');
$('.index-layout .map .red span').removeClass('active');
$('.index-layout .map .red span:nth-child('+index+')').addClass('active');
});
$('.index-layout .bottom .con:nth-child(2) .list .slick-slide').on('mouseenter', function(){
var index = $(this).index()+1;
$('.index-layout .map .red span').removeClass('active');
$('.index-layout .map .yellow span').removeClass('active');
$('.index-layout .map .yellow span:nth-child('+index+')').addClass('active');
});
});
// 首页-新闻中心
$(function(){
var newSlick = $('.new-slick').slick({
autoplay: true, // 是否自动播放
autoplaySpeed: 5000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: true, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 1, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: true, // 是否显示圆点指示器
arrows: false, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: true, //启用选定元素的焦点(单击)
infinite: true, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 1, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 1, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
pauseOnHover: false,
responsive: [ // 响应式
{
breakpoint: 767,
settings: {
slidesToShow: 1
}
},
],
});
});
// 内页导航
$(function(){
$('.page-nav .con .link a').on('mouseenter', function(){
$(this).parent().children('a').removeClass('active');
$(this).addClass('active');
});
$('.page-nav .con .link').on('mouseleave', function(){
$(this).children('a').removeClass('active');
$(this).children('.cur').addClass('active');
});
// 内页导航滑动
if ($("#list-nav").length > 0) {
$child = $($("#list-nav .active").get(0));
$parent = $("#list-nav");
$parent.animate({ scrollLeft: $parent.scrollLeft() + $child.offset().left - $parent.offset().left }, 1000);
}
});
// 发展历程
$(function(){
$('.about-history .top .text p').on('mouseenter', function(){
var index = $(this).index()+1;
$(this).parent().children('p').removeClass('active');
$(this).addClass('active');
$('.about-history .top .img p').removeClass('active');
$('.about-history .top .img p:nth-child('+index+')').addClass('active');
});
$('.about-history .bottom .time a').on('click', function(){
var hisTop = $("#text-nav").offset().top - 140;
$('html, body').animate({ scrollTop: hisTop }, 400);
$(this).parent().children('a').removeClass('active');
$(this).addClass('active');
$tt = $(this);
$time = $('#time-nav');
$time.animate({ scrollTop: $time.scrollTop() + $tt.offset().top - $time.offset().top - 90 }, 1000);
var id = $(this).attr('data-id');
$child = $('#'+id);
$parent = $("#text-nav");
$parent.animate({ scrollTop: $parent.scrollTop() + $child.offset().top - $parent.offset().top }, 1000);
$('.about-history .bottom .text .list .tit').removeClass('active');
$child.next().children('.tit').addClass('active');
});
$('.about-history .bottom .text').on('scroll', function(){
var textTop = $(this).scrollTop();
});
});
// 荣誉资质
$(function(){
var galleryTop = new Swiper('.gallery-top', {
spaceBetween: 10,
loop:false,
loopedSlides: 3,
onSlideChangeStart:function(swiper){
console.log(swiper.activeIndex);
$('.about-honor .top .right .swiper-slide').css('border','8px solid #eee');
galleryThumbs.slides[swiper.activeIndex].style.border = '8px solid #e01724';
}
});
var galleryThumbs = new Swiper('.gallery-thumbs', {
direction: 'vertical',
spaceBetween: 10,
slidesPerView: 3,
touchRatio: 0.2,
slideToClickedSlide: true,
loop:false,
loopedSlides: 3,
breakpoints: {
767: {
direction: 'horizontal',
},
},
});
galleryTop.params.control = galleryThumbs;
galleryThumbs.params.control = galleryTop;
if ($('.gallery-top').length) {
galleryThumbs.slides.click(function(){
$('.about-honor .top .right .swiper-slide').css('border','8px solid #eee');
galleryTop.slideTo($(this).index());
galleryThumbs.slides[$(this).index()].style.border = '8px solid #e01724';
});
}
var honorSlick = $('.honor-slick').slick({
autoplay: true, // 是否自动播放
autoplaySpeed: 5000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: false, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 3.5, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: false, // 是否显示圆点指示器
arrows: true, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: true, //启用选定元素的焦点(单击)
infinite: true, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 1, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 1, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
pauseOnHover: false,
responsive: [ // 响应式
{
breakpoint: 767,
settings: {
slidesToShow: 1
}
},
],
});
});
// 领导关怀
$(function(){
var leaderSlick = $('.leader-slick').slick({
autoplay: true, // 是否自动播放
autoplaySpeed: 5000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: true, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 1, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: true, // 是否显示圆点指示器
arrows: true, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: true, //启用选定元素的焦点(单击)
infinite: true, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 1, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 1, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
pauseOnHover: false,
responsive: [ // 响应式
{
breakpoint: 767,
settings: {
slidesToShow: 1,
arrows: false,
}
},
],
});
});
// 新闻中心-集团要闻
$(function(){
$('.news-group .top .r .list').on('mouseenter', function(){
var index = $(this).index()+1;
$('.news-group .top .img').removeClass('active');
$('.news-group .top .img:nth-child('+index+')').addClass('active');
$(this).parent().children('.list').removeClass('active');
$(this).addClass('active');
$('.news-group .top .r .list .con').stop().slideUp();
$(this).find('.con').stop().slideDown();
});
$('.news-group .top .r .list>a').on('click', function(event){
if (winW < 767) {
// event.stopPropagation();
// event.preventDefault();
}
});
});
// 新闻详情
$(function(){
// 放大缩小字体
var $biger = $('.news-details .details .con');
var num = parseFloat($biger.css('fontSize'));
$('.switcher-bigger').click(function() {
num = num * 1.1;
$biger.css('fontSize', num + 'px');
});
$('.switcher-small').click(function() {
num = num / 1.1;
$biger.css('fontSize', num + 'px');
});
});
// 人才招聘
$(function(){
$('.resource-recruit .list .top').on('click', function(){
$(this).parent().parent().find('.list .bottom').stop().slideUp();
$(this).parent().children('.bottom').stop().slideDown();
$('.resource-recruit .list').removeClass('active');
$(this).parent().addClass('active');
});
$('.resource-recruit .list .bottom .link .application').on('click', function(){
var tit = $(this).parent().parent().parent().find('.top>div p:first-child').text();
$('.recruit-message .con .title p').html(tit);
$('.recruit-message .con .job-title').val(tit);
$('.recruit-message').show();
});
$('.recruit-message .con .list .reset').on('click', function(event){
event.preventDefault();
$('.recruit-message').hide();
});
$('.recruit-message .con .title .close').on('click', function(){
$('.recruit-message').hide();
});
});
// 联系我们
$(function(){
$('.contact .bottom .left .con .list .text a').on('click', function(){
$('.contact .bottom .left .con .list .text a').removeClass('active');
$(this).addClass('active');
});
});
// 公司简介
$(function(){
var aboutCompany = document.getElementById('aboutCompany');
$('.about-company .bottom .video .bg').on('click', function(){
$(this).addClass('active');
aboutCompany.play();
});
if (aboutCompany) {
aboutCompany.addEventListener('ended', function(){
$('.about-company .bottom .video .bg').removeClass('active');
});
}
});
// 全球布局
$(function(){
var layoutSlick = $('.lay-slick').slick({
autoplay: true, // 是否自动播放
autoplaySpeed: 5000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: true, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 1, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: true, // 是否显示圆点指示器
arrows: false, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: true, //启用选定元素的焦点(单击)
infinite: true, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 1, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 1, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
pauseOnHover: false,
responsive: [ // 响应式
{
breakpoint: 767,
settings: {
slidesToShow: 1
}
},
],
});
$('.about-layout .con-cn .left .list .icon').on('mouseenter', function(){
$('.about-layout .con-cn .left .list').removeClass('active');
$(this).parent().addClass('active');
var index = $(this).parent().index()+1;
$('.about-layout .con-cn .right .list').removeClass('active');
$('.about-layout .con-cn .right .list:nth-child('+index+')').addClass('active');
});
});
// 专家介绍
$(function(){
var expertTop = new Swiper('.expert-top', {
autoplay: 4000,
slidesPerView: 1.41,
spaceBetween: 50,
loop:true,
loopedSlides: 6,
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
breakpoints: {
991: {
spaceBetween: 20,
slidesPerView: 1,
},
},
});
var expertThumbs = new Swiper('.expert-thumbs', {
spaceBetween: 115,
slidesPerView: 6,
touchRatio: 0.2,
slideToClickedSlide: true,
loop:true,
loopedSlides: 6,
breakpoints: {
1680: {
spaceBetween: 90,
},
1440: {
spaceBetween: 60,
},
1200: {
slidesPerView: 5,
spaceBetween: 30,
},
991: {
slidesPerView: 4,
spaceBetween: 20,
},
767: {
slidesPerView: 2,
spaceBetween: 20,
},
},
});
expertTop.params.control = expertThumbs;
expertThumbs.params.control = expertTop;
});
// 创新成果
$(function(){
$('.achievement-middle .link a').on('click', function(){
$(this).parent().children('a').removeClass('active');
$(this).addClass('active');
var index = $(this).index()+1;
$('.achievement-middle .con .list').removeClass('active');
$('.achievement-middle .con .list:nth-child('+index+')').addClass('active');
});
var achievementSlick = $('.achievement-slick').slick({
autoplay: true, // 是否自动播放
autoplaySpeed: 5000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: false, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 4, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: false, // 是否显示圆点指示器
arrows: true, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: true, //启用选定元素的焦点(单击)
infinite: true, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 1, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 1, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
pauseOnHover: false,
responsive: [ // 响应式
{
breakpoint: 767,
settings: {
slidesToShow: 2
}
},
],
});
$('.achievement-bottom .left .list a').on('click', function(){
$(this).parent().parent().children('.list').removeClass('active');
$(this).parent().addClass('active');
var index = $(this).parent().index()+1;
$('.achievement-bottom .con .list').removeClass('active');
$('.achievement-bottom .con .list:nth-child('+index+')').addClass('active');
});
});
// 种植业服务
$(function(){
var zzySlick = $('.zzy-slick').slick({
autoplay: true, // 是否自动播放
autoplaySpeed: 5000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: true, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 1, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: true, // 是否显示圆点指示器
arrows: false, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: true, //启用选定元素的焦点(单击)
infinite: true, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 1, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 1, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
pauseOnHover: false,
});
});
// 国际业务
$(function(){
var gjywSlick = $('.gjyw-slick').slick({
autoplay: false, // 是否自动播放
autoplaySpeed: 5000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: false, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 1, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: true, // 是否显示圆点指示器
arrows: false, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: false, //启用选定元素的焦点(单击)
infinite: false, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 2, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 3, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
draggable: true,
pauseOnHover: false,
responsive: [ // 响应式
{
breakpoint: 767,
settings: {
slidesPerRow: 1
}
},
],
});
$('.gjyw-slick .slick-slide .img').on('mouseenter', function(){
gjywSlick.slick('slickSetOption',{draggable: false});
}).on('mouseleave', function(){
gjywSlick.slick('slickSetOption',{draggable: true});
});
$('.industry-gjyw .link a').on('click', function(){
$(this).parent().children('a').removeClass('active');
$(this).addClass('active');
var index = $(this).index()+1;
$('.industry-gjyw .con .gjyw').removeClass('active');
$('.industry-gjyw .con .gjyw:nth-child('+index+')').addClass('active');
});
});
// 文化理念
// $(function(){
// $('.box-list-bg .con .list').on('mouseenter', function(){
// $(this).parent().children('.list').removeClass('active');
// $(this).addClass('active');
// });
// });
// 文化手册
$(function(){
var manualTop = new Swiper('.manual-top', {
autoplay: 5000,
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
spaceBetween: 10,
loop:true,
loopedSlides: 4,
});
var manualThumbs = new Swiper('.manual-thumbs', {
spaceBetween: 10,
slidesPerView: 4,
touchRatio: 0.2,
slideToClickedSlide: true,
loop:true,
loopedSlides: 4,
pagination: '.swiper-pagination',
paginationType : 'custom',
breakpoints: {
767: {
slidesPerView: 3,
loopedSlides: 3,
}
},
paginationCustomRender: function (swiper, current, total) {
var w = (100 / total) * current;
return "";
}
});
manualTop.params.control = manualThumbs;
manualThumbs.params.control = manualTop;
});
// 社会责任
$(function(){
$('.liability-top .right .list a').on('mouseenter', function(){
$(this).parent().children('a').removeClass('active');
$(this).addClass('active');
var index = $(this).index()+1;
$('.liability-top .left .img').removeClass('active');
$('.liability-top .left .img:nth-child('+index+')').addClass('active');
});
var liabilityMiddle = new Swiper('.liability-middle-swiper', {
autoplay: 5000,
spaceBetween: 30,
slidesPerView: 3,
touchRatio: 0.2,
slideToClickedSlide: false,
loop:true,
pagination: '.swiper-pagination',
paginationType : 'progress',
breakpoints: {
767: {
slidesPerView: 1,
}
},
});
var activitySlick = $('.activity-slick').slick({
autoplay: true, // 是否自动播放
autoplaySpeed: 5000, // 自动播放间隔时间
centerMode: false, // 居中视图 slidesToShow为双数的时候慎用
centerPadding: '0px', //左右两侧padding值
fade: true, // 启用淡入淡出,slidesToShow大于1有问题
speed: 500, // 切换动画速度
slidesToShow: 1, // 显示的幻灯片数量
slidesToScroll: 1, // 要滚动的幻灯片数量
pauseOnHover: false, // 悬停时是否暂停自动播放
dots: true, // 是否显示圆点指示器
arrows: false, // 是否开启左右切换箭头 上一页,下一页
touchThreshold: 100, // 滑动切换阈值,即滑动多少像素后切换
cssEase: 'ease', //CSS3动画缓和
focusOnSelect: true, //启用选定元素的焦点(单击)
infinite: true, //无限循环
swipeToSlide: true, //允许用户将幻灯片直接拖动或滑动到幻灯片
lazyLoad: 'ondemand', //接受'ondemand'或'progressive'
variableWidth: false, //幻灯片宽度自适应
adaptiveHeight: false, //自适应高度
rows: 1, //将其设置为1以上将初始化网格模式。使用slidesPerRow设置每行应放置多少个幻灯片
slidesPerRow: 1, //在通过行选项初始化网格模式时,这会设置每个网格行中的幻灯片数量
pauseOnHover: false,
});
});
// 新闻-视频中心
$(function(){
$('.news-video .top .right .list').on('click', function(){
var newVideo = document.querySelector('.news-video .top .left .video video');
newVideo.pause();
});
});
/* 友情链接 */
$(function(){
$('.footer .top .left .logo .link > div a').on('mouseenter', function(){
var index = $(this).index() + 1;
$('.link-container .link-slide').stop().slideUp();
$('.link-container .link-slide:nth-child('+index+')').stop().slideDown();
$('.footer .top .left .logo .link a').removeClass('active');
$(this).addClass('active');
})
$('.footer .top .link-slide').on('mouseleave', function(){
$('.link-container .link-slide').slideUp();
$('.footer .top .left .logo .link a').removeClass('active');
});
$('.footer .top .left .nav').on('mouseenter', function(){
$('.link-container .link-slide').slideUp();
$('.footer .top .left .logo .link a').removeClass('active');
})
})