$(document).ready(function() {

	/***************** Waypoints ******************/

	$('.wp1').waypoint(function() {
		$('.wp1').addClass('animated fadeInUp');
	}, {
		offset: '75%'
	});
	$('.wp2').waypoint(function() {
		$('.wp2').addClass('animated fadeInUp');
	}, {
		offset: '75%'
	});
	$('.wp3').waypoint(function() {
		$('.wp3').addClass('animated fadeInRight');
	}, {
		offset: '75%'
	});

	/***************** Initiate Flexslider ******************/
	$('.flexslider').flexslider({
		animation: "slide"
	});

	/***************** Initiate Fancybox ******************/

	$('.single_image').fancybox({
		padding: 4,
	});

	/***************** Tooltips ******************/
    $('[data-toggle="tooltip"]').tooltip();

	/***************** Nav Transformicon ******************/

	/* When user clicks the Icon */
	$('.nav-toggle').click(function() {
		$(this).toggleClass('active');
		//$(this).parent('.navicon').toggleClass('fixed');
		$('.header-nav').toggleClass('open');
		event.preventDefault();
	});
	/* When user clicks a link */
	$('.header-nav li a').click(function() {
		$('.nav-toggle').toggleClass('active');
		$('.header-nav').toggleClass('open');

	});

	/***************** Header BG Scroll ******************/

	$(function() {
		$(window).scroll(function() {
			var scroll = $(window).scrollTop();

			if (scroll >= 20) {
				$('.navigation').addClass('fixed');
				$('header .navicon').css({
					"top": "28px",
				});
			} else {
				$('.navigation').removeClass('fixed');
				$('header .navicon').css({
					"top": "28px",
				});
			}
		});
	});
	/***************** Smooth Scrolling ******************/

	$(function() {
		//Swiper
	    var swiper = new Swiper('.Carousel .swiper-container', {
	        pagination: '.Carousel .swiper-pagination',
	        nextButton: '.Carousel .swiper-button-next',
        	prevButton: '.Carousel .swiper-button-prev',
	        slidesPerView: 3,
	        paginationClickable: true,
	        spaceBetween: 25,
	        breakpoints: {//响应式的
                480: {
                    slidesPerView: 1,
                    spaceBetween:0,
                },
                680: {
                    slidesPerView: 2,
                    spaceBetween: 15,
                },
                700: {
                    slidesPerView: 3,
                    spaceBetween: 25,
                }
            }

	    });


		var swiper = new Swiper('.indxebanner .swiper-container', {
		    pagination: '.indxebanner .swiper-pagination',
		    paginationClickable: true
		});

		var swiper = new Swiper('.Carousel_a .swiper-container', {
	        pagination: '.Carousel_a .swiper-pagination',
	        nextButton: '.Carousel_a .swiper-button-next',
        	prevButton: '.Carousel_a .swiper-button-prev',
	        slidesPerView: 4,
	        paginationClickable: true,
	        spaceBetween: 20,
	        breakpoints: {//响应式的
                480: {  
                    slidesPerView: 1,  
                    spaceBetween:0,  
                },
                680: {  
                    slidesPerView: 2,
                    spaceBetween: 14,
                },
                768: {
                    slidesPerView: 3,
                    spaceBetween: 20,
                }
            }
	    });	   

	    //------------------关于我们---------------
	    $('.ple-oriented').hover(function(){
			$(this).find('.img-oriented').find('i').stop().fadeOut();
		},function(){
			$(this).find('.img-oriented').find('i').stop().fadeIn();
		});
	});

});



(function () {

    var nav = $("#navObj");
    var line=parseInt($('.navigation').height());

    var afterNavObj = $("#mk02");

    var topDis = nav.offset().top;

    var windowTop = 0;

    $(window).on("scroll", function () {

        windowTop = $(window).scrollTop();

        if (windowTop >= topDis) {

            nav.addClass("fixed-nav").css('top',line);

            afterNavObj.css("margin-top", nav.height());

        } else {

            nav.removeClass("fixed-nav").css('top','');

            afterNavObj.css("margin-top", 0);

        }

    });

})();
