$(window).resize(function () { var fHeight = $("footer").outerHeight(); $(".wrap").css({ marginBottom: fHeight }); }); $(function () { var fHeight = $("footer").outerHeight(); $(".wrap").css({ marginBottom: fHeight }); $(".parallax-background").parallax({ calibrateX: true, calibrateY: true, invertX: true, invertY: true, limitX: true, limitY: 10, scalarX: 5, scalarY: 8 }); $('.title') .waypoint(function (direction) { if (direction === 'down') { $(this.element).addClass("fadeIn-title"); } else { $(this.element).removeClass('fadeIn-title'); } }, { offset: '80%' } ); }); var swiper2 = new Swiper('.swiper2', { slidesPerView: 3, spaceBetween: 24, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' } }); var swiper1 = new Swiper('.swiper1', { //loop: true, threshold: 100, autoplay: { delay: 8000, disableOnInteraction: false }, pagination: { el: '.swiper-pagination', clickable: true, renderBullet: function (index, className) { return ''; } }, on: { init: function () { slide = this.slides.eq(0); slide.find(".desc").addClass('active'); }, transitionStart: function () { for (i = 0; i < this.slides.length; i++) { slide = this.slides.eq(i); slide.find(".desc").removeClass('active'); slide.find(".knowMore").removeClass('active'); } }, transitionEnd: function () { slide = this.slides.eq(this.activeIndex); slide.find(".desc").addClass('active'); slide.find(".knowMore").addClass('active'); //if (this.activeIndex !== 1) { // $(".baigu-video video")[0].load(); // $(".baigu-video video")[0].pause(); //} else { // $(".baigu-video video")[0].play(); //} } } }); //$(".baigu-video video").bind("play", function () { // swiper1.autoplay.stop(); // $(".video video")[0].pause(); // $(".video .video-play-btn").show(); // $(".video").animate({ height: "500px" }, 500); // $(".show-video").css("opacity", 0); // $(".video").removeClass("active"); //}); //$(".baigu-video video").bind("ended", function () { // swiper1.autoplay.start(); //}); var swiper3 = new Swiper('.swiper3', { effect: 'fade', autoplay: { delay: 1000, disableOnInteraction: false, }, loop: true, }); $(".video-play-btn").click(function () { $(this).siblings("video")[0].play(); $(this).siblings("video").addClass("active"); $(this).hide(); $(".video").addClass("active"); var h1 = $(".video video").height(); var h2 = $(".video-show").height(); $(".video").animate({ height: h1 }, 500); $(".show-video").css("opacity", 1); var s = $(window).scrollTop() + (h1 - h2) / 2; $('html,body').animate({ scrollTop: s }, 500); }); $(".video-pause-btn").click(function () { $(this).siblings("video")[0].pause(); $(this).siblings(".video-play-btn").show(); $(".video").animate({ height: "500px" }, 500); $(".show-video").css("opacity", 0); $(".video").removeClass("active"); var h1 = $(".video video").height(); var s = $(window).scrollTop() - (h1 - 500) / 2; $('html,body').animate({ scrollTop: s }, 500); });