318 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			JavaScript
		
	
	
			
		
		
	
	
			318 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			JavaScript
		
	
	
| $(function(){
 | ||
| 	// 执行加载动画
 | ||
| 	if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){
 | ||
| 		var wow = new WOW({
 | ||
| 	  		boxClass: 'wow',   /* 执行动画的元素 class */
 | ||
| 	  		animateClass: 'animated',   /* animate.css 动画的 class */
 | ||
| 	  		offset: 10,   /* 距离可视区域多少开始执行动画 */
 | ||
| 	  		mobile: true,  /* 是否在移动设备执行动画 */
 | ||
| 	  		live: true     /* 异步加载的内容是否有效 */
 | ||
| 		});
 | ||
| 		wow.init();  
 | ||
| 	};
 | ||
| 	
 | ||
| 	// 滑动页面更改头部效果
 | ||
| 	if(window.innerWidth <= 1024){
 | ||
| 		$('.header').addClass('header-white');
 | ||
| 	}else{
 | ||
| 		$(window).scroll(function(){
 | ||
| 		  	var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
 | ||
| 			if(scrollTop > 30){
 | ||
| 				$('.header').addClass('header-white');
 | ||
| 			} else {
 | ||
| 				$('.header').removeClass('header-white');
 | ||
| 			}
 | ||
| 		});
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 轮播动画
 | ||
| 	if($('.banner-swiper').length){
 | ||
| 		var bannerSwiper = new Swiper('.banner-swiper',{
 | ||
| 			loop:true,//开启循环播放
 | ||
| 			autoplay: {//开启自动播放
 | ||
| 				delay:3500,
 | ||
| 				disableOnInteraction: false,//触摸后不会停止自动滚动
 | ||
| 				pauseOnMouseEnter: true,//鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。
 | ||
| 			},
 | ||
| 			pagination: {
 | ||
| 				el: '.banner-swiper .swiper-pagination',
 | ||
| 				clickable :true,
 | ||
| 			},
 | ||
| 			effect : 'fade',//轮播的动效 默认为"slide"(普通位移切换),还可设置为"fade"(淡入)、"cube"(方块)、"coverflow"(3d流)、"flip"(3d翻转)、"cards"(卡片式)、"creative"(创意性)。
 | ||
| 			fadeEffect: {
 | ||
| 				crossFade: true,
 | ||
| 			},
 | ||
| 			navigation: {
 | ||
| 				nextEl: '.banner-swiper .swiper-button-next',
 | ||
| 				prevEl: '.banner-swiper .swiper-button-prev',
 | ||
| 			},
 | ||
| 			on:{
 | ||
| 				init: function(){
 | ||
| 					swiperAnimateCache(this); // 隐藏动画元素 
 | ||
| 					swiperAnimate(this); // 初始化完成开始动画
 | ||
| 				}, 
 | ||
| 				slideChangeTransitionEnd: function(){ 
 | ||
| 					swiperAnimate(this); // 每个slide切换结束时也运行当前slide动画
 | ||
| 					// this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); 动画只展现一次,去除ani类名
 | ||
| 				},
 | ||
| 			}
 | ||
| 		});
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 首页新闻资讯切换
 | ||
| 	if($('.index-news-nav').length){
 | ||
| 		// 导航切换
 | ||
| 		$('.index-news-nav>span').eq(0).addClass('active');
 | ||
| 		$('.new-list>.swiper').eq(0).addClass('show');
 | ||
| 		$('.index-news-nav>span').click(function(){
 | ||
| 			if(!$(this).hasClass('active')){
 | ||
| 				$('.index-news-nav>span').eq($(this).index()).addClass("active").siblings().removeClass('active');
 | ||
| 				$('.new-list>.swiper').eq($(this).index()).addClass("show").siblings().removeClass('show');
 | ||
| 			}else{
 | ||
| 				window.location.href = $(this).data('url');
 | ||
| 			}
 | ||
| 		})
 | ||
| 		if(window.innerWidth <= 1024){
 | ||
| 			// 公司新闻切换
 | ||
| 			var newsSwiper = new Swiper('.new-list>.swiper',{
 | ||
| 				loop:true,//开启循环播放
 | ||
| 				autoplay: {//开启自动播放
 | ||
| 					delay:2000,
 | ||
| 					disableOnInteraction: false,//触摸后不会停止自动滚动
 | ||
| 					pauseOnMouseEnter: true,//鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。
 | ||
| 				},
 | ||
| 				slidesPerView: "auto",
 | ||
| 				centeredSlides:true,
 | ||
| 				pagination: {
 | ||
| 					el: '.new-list>.swiper .swiper-pagination',
 | ||
| 					clickable :true,
 | ||
| 				},
 | ||
| 			});
 | ||
| 		}else{
 | ||
| 			// 公司新闻切换
 | ||
| 			var newsSwiper = new Swiper('.new-list>.swiper',{
 | ||
| 				direction: 'vertical', //向上
 | ||
| 				loop:true,//开启循环播放
 | ||
| 				autoplay: {//开启自动播放
 | ||
| 					delay:2000,
 | ||
| 					disableOnInteraction: false,//触摸后不会停止自动滚动
 | ||
| 					pauseOnMouseEnter: true,//鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。
 | ||
| 				},
 | ||
| 				effect : 'fade',
 | ||
| 				fadeEffect: {
 | ||
| 					crossFade: true,
 | ||
| 				},
 | ||
| 				pagination: {
 | ||
| 					el: '.new-list>.swiper .swiper-pagination',
 | ||
| 					clickable :true,
 | ||
| 				},
 | ||
| 			});
 | ||
| 		}
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 管理团队切换
 | ||
| 	if($('.management-team-list').length){
 | ||
| 		$('.team-nav-show').text($('.management-team-nav>span').eq(0).text());
 | ||
| 		$('.management-team-nav>span').eq(0).addClass('active');
 | ||
| 		$('.management-team-list .management-team-item').eq(0).addClass('show');
 | ||
| 		if(window.innerWidth <= 1024){
 | ||
| 			$('.team-nav-show').click(function(){
 | ||
| 				$(this).toggleClass('cur');
 | ||
| 				$('.management-team-nav').toggleClass('no-hide');
 | ||
| 			})
 | ||
| 			$('.management-team-nav>span').click(function(){
 | ||
| 				var scrollTop = $(document).scrollTop();
 | ||
| 				$(document).scrollTop(scrollTop+1).scrollTop(scrollTop);
 | ||
| 				$('.team-nav-show').text($(this).text());
 | ||
| 				$('.team-nav-show').removeClass('cur');
 | ||
| 				$('.management-team-nav').removeClass('no-hide');
 | ||
| 				$('.management-team-list .management-team-item').removeClass('show');
 | ||
| 				$('.management-team-list .management-team-item').eq($(this).index()).addClass("show");
 | ||
| 			})
 | ||
| 		}else{
 | ||
| 			$('.management-team-nav>span').click(function(){
 | ||
| 				var scrollTop = $(document).scrollTop();
 | ||
| 				if(!$(this).hasClass('active')){
 | ||
| 					$(document).scrollTop(scrollTop+1).scrollTop(scrollTop);
 | ||
| 					$('.management-team-nav>span').eq($(this).index()).addClass("active").siblings().removeClass('active');
 | ||
| 					$('.management-team-list .management-team-item').removeClass('show');
 | ||
| 					$('.management-team-list .management-team-item').eq($(this).index()).addClass("show");
 | ||
| 				}
 | ||
| 			})
 | ||
| 		}
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 媒体报道导航
 | ||
| 	if(window.innerWidth <= 1024){
 | ||
| 		$('.news-nav-show').text($('.news-nav>a.active').text());
 | ||
| 		$('.news-nav-show').click(function(){
 | ||
| 			$(this).toggleClass('cur');
 | ||
| 			$('.news-nav').toggleClass('no-hide');
 | ||
| 		})
 | ||
| 		$('.news-nav>a').click(function(){
 | ||
| 			window.location.href = $(this).data('url');
 | ||
| 		})
 | ||
| 	}else{
 | ||
| 		$('.news-nav>a').click(function(){
 | ||
| 			if(!$(this).hasClass('active')){
 | ||
| 				window.location.href = $(this).data('url');
 | ||
| 			}
 | ||
| 		})
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 尾部导航
 | ||
| 	if(window.innerWidth <= 1024){
 | ||
| 		$('.foot-left>.item>a').click(function(){
 | ||
| 			if(!$(this).parent().hasClass('active')){
 | ||
| 				$('.foot-left>.item').removeClass('active');
 | ||
| 				$(this).parent().addClass("active");
 | ||
| 			}else{
 | ||
| 				$('.foot-left>.item').removeClass('active');
 | ||
| 			}
 | ||
| 		})
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 大事件切换
 | ||
| 	if($('.history-swiper').length){
 | ||
| 		var historySwiper = new Swiper('.history-swiper',{
 | ||
| 			direction: 'vertical', //向上
 | ||
| 			slidesPerView: 'auto',
 | ||
| 			navigation: {
 | ||
| 				nextEl: '.history-swiper-bg .swiper-button-next',
 | ||
| 				prevEl: '.history-swiper-bg .swiper-button-prev',
 | ||
| 			},
 | ||
| 		});
 | ||
| 		
 | ||
| 		$('.history .img>span').eq(0).addClass('active');
 | ||
| 		$(document).on('click','.history-swiper .swiper-slide',function() {
 | ||
| 			$('.history .img>span').eq($(this).index()).addClass("active").siblings().removeClass('active');
 | ||
| 		})
 | ||
| 	}
 | ||
| 	
 | ||
| 	
 | ||
| 	// 活动预告切换
 | ||
| 	if($('.preview-swiper').length){
 | ||
| 		var previewSwiper = new Swiper('.preview-swiper',{
 | ||
| 			loop:true,//开启循环播放
 | ||
| 			autoplay: {//开启自动播放
 | ||
| 				delay:3000,
 | ||
| 				disableOnInteraction: false,//触摸后不会停止自动滚动
 | ||
| 				pauseOnMouseEnter: true,//鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。
 | ||
| 			},
 | ||
| 			slidesPerView: "auto",
 | ||
| 			centeredSlides:true,
 | ||
| 			navigation: {
 | ||
| 				nextEl: '.preview-swiper .swiper-button-next',
 | ||
| 				prevEl: '.preview-swiper .swiper-button-prev',
 | ||
| 			},
 | ||
| 		});
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 活动详情轮播
 | ||
| 	if($('.detail-swiper').length){
 | ||
| 		var detailSwiper = new Swiper('.detail-swiper',{
 | ||
| 			loop:true,//开启循环播放
 | ||
| 			autoplay: {//开启自动播放
 | ||
| 				delay:3000,
 | ||
| 				disableOnInteraction: false,//触摸后不会停止自动滚动
 | ||
| 				pauseOnMouseEnter: true,//鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。
 | ||
| 			},
 | ||
| 			effect : 'fade',
 | ||
| 			fadeEffect: {
 | ||
| 				crossFade: true,
 | ||
| 			},
 | ||
| 			pagination: {
 | ||
| 				el: '.detail-swiper .swiper-pagination',
 | ||
| 				clickable :true,
 | ||
| 			},
 | ||
| 			navigation: {
 | ||
| 				nextEl: '.detail-swiper .swiper-button-next',
 | ||
| 				prevEl: '.detail-swiper .swiper-button-prev',
 | ||
| 			},
 | ||
| 		});
 | ||
| 	}
 | ||
| 	// 友邻集市社区切换
 | ||
| 	if($('.market-banner-swiper').length){
 | ||
| 		// 集市切换
 | ||
| 		var marketBannerSwiper = new Swiper('.market-banner-swiper',{
 | ||
| 			loop:true,//开启循环播放
 | ||
| 			autoplay: {//开启自动播放
 | ||
| 				delay:3000,
 | ||
| 				disableOnInteraction: false,//触摸后不会停止自动滚动
 | ||
| 				pauseOnMouseEnter: true,//鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。
 | ||
| 			},
 | ||
| 			pagination: {
 | ||
| 				el: '.market-banner-swiper .swiper-pagination',
 | ||
| 				clickable :true,
 | ||
| 			},
 | ||
| 		});
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 友邻市集活动切换
 | ||
| 	if($('.market-swiper').length){
 | ||
| 		if(window.innerWidth > 1024){
 | ||
| 			var marketSwiper = new Swiper('.market-swiper',{
 | ||
| 				loop:true,//开启循环播放
 | ||
| 				autoplay: {//开启自动播放
 | ||
| 					delay:3000,
 | ||
| 					disableOnInteraction: false,//触摸后不会停止自动滚动
 | ||
| 					pauseOnMouseEnter: true,//鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。
 | ||
| 				},
 | ||
| 				pagination: {
 | ||
| 					el: '.market-swiper .swiper-pagination',
 | ||
| 					clickable :true,
 | ||
| 				},
 | ||
| 				on:{
 | ||
| 					init: function(){
 | ||
| 						swiperAnimateCache(this); // 隐藏动画元素 
 | ||
| 						swiperAnimate(this); // 初始化完成开始动画
 | ||
| 					}, 
 | ||
| 					slideChangeTransitionEnd: function(){ 
 | ||
| 						swiperAnimate(this); // 每个slide切换结束时也运行当前slide动画
 | ||
| 						// this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); 动画只展现一次,去除ani类名
 | ||
| 					},
 | ||
| 				}
 | ||
| 			});
 | ||
| 		}
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 手机导航按钮
 | ||
| 	if(window.innerWidth <= 1024){
 | ||
| 		$('.head .head-btn').click(function(){
 | ||
| 			if ($('.head .head-btn').attr('class') == 'head-btn cur') {
 | ||
| 				$('.head .head-btn').removeClass('cur');
 | ||
| 				$('.head .nav').removeClass('active');
 | ||
| 				$('.head .nav-bg').removeClass('active');
 | ||
| 			} else {
 | ||
| 				$('.head .head-btn').addClass('cur');
 | ||
| 				$('.head .nav').addClass('active');
 | ||
| 				$('.head .nav-bg').addClass('active');
 | ||
| 			}
 | ||
| 		});
 | ||
| 		
 | ||
| 		$('.head .nav-bg').click(function(){	
 | ||
| 			$(this).removeClass('active');
 | ||
| 			$('.head .head-btn').removeClass('cur');
 | ||
| 			$('.head .nav').removeClass('active');
 | ||
| 		});
 | ||
| 	}
 | ||
| 	
 | ||
| 	// 手机端二级导航
 | ||
| 	if(window.innerWidth <= 1024){
 | ||
| 		if($('.sub-nav-bg').length){
 | ||
| 			let parentWidth = $('.sub-nav-bg').width();
 | ||
| 			let offsetLeft = $('.sub-nav>.active').offset().left;
 | ||
| 			if(offsetLeft>parentWidth/2){
 | ||
| 				$('.sub-nav').scrollLeft(offsetLeft);
 | ||
| 			}
 | ||
| 		}
 | ||
| 		if($('.sub-nav-bg-01').length){
 | ||
| 			if($('.sub-nav-01>a').eq($('.sub-nav-01>a').length-1).hasClass('active')){
 | ||
| 				$('.sub-nav-bg-01').addClass('last');
 | ||
| 			}else{
 | ||
| 				$('.sub-nav-bg-01').removeClass('last');
 | ||
| 			}
 | ||
| 		}
 | ||
| 	}
 | ||
| 	
 | ||
| }) |