var shuwon = { percent: 0, timers: "", init: function(e) { shuwon.backTop(); util.toastInit(); $(document).ready(function() { var p = 0, t = 0; $(window).scroll(function(e) { p = $(this).scrollTop(); if (p > 0) { $("header").addClass("active2") } else { $("header").removeClass("active2").addClass("active") } }); }); $('.backTops').click(function() { $('body,html').animate({ scrollTop: 0 }, 500); }) $("header").hover(function() { $('.header').addClass('headerActive') }, function() { $('.header').removeClass('headerActive') }) $(function () { $('.sp_nav').click(function () { $('.sp_nav').toggleClass('sp_nav_se'); $('.sjj_nav').toggleClass('nav_show'); $('.mengBan').toggleClass('nav_show2'); }); $('.sp_flex .sjj_nav .close').click(function () { $('.sp_nav').toggleClass('sp_nav_se'); $('.sjj_nav').toggleClass('nav_show'); $('.mengBan').toggleClass('nav_show2'); }); $('.sjj_nav ul li i').click(function () { $(this).parent().children('ul').slideToggle().parent().siblings().children('ul').slideUp(); $(this).toggleClass('sjj_nav_i_se'); $(this).parent().siblings().find('i').removeClass('sjj_nav_i_se'); $(this).parent('li').addClass("active").siblings().removeClass("active"); }); $('.sp_nav_xjb').html(''); }); }, index: function() { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: true, live: true }).init(); var rellax = new Rellax('.rellax') var form = document.getElementById('form'); $('.subimt').click(function () { if (form.name.value == '') { util.toast({ string: '璇疯緭鍏ユ偍鐨勫鍚?, type: 'warning' }); return false; } if (form.phone.value == '') { util.toast({ string: '璇疯緭鍏ユ偍鐨勮仈绯绘柟寮?, type: 'warning' }); return false; } if (form.email.value == '') { util.toast({ string: '璇疯緭鍏ユ偍鐨勯偖绠卞彿鐮?, type: 'warning' }); return false; } if (form.content.value == '') { util.toast({ string: '璇疯緭鍏ョ暀瑷€鍐呭', type: 'warning' }); return false; } shuwon.getDataForApi('post', '/apiform.html', { name: form.name.value, phone: form.phone.value, email: form.email.value, content: form.content.value, '_csrf-frontend': $('#csrf').val() }, function (res) { if(res.code == '200') { util.toast({ string: '鎻愪氦鎴愬姛', type: 'success' }); form.name.value = ''; form.phone.value = ''; form.email.value = ''; form.content.value = ''; } else { util.toast({ string: res.message, type: 'error' }); } }) }) }, mouseCircle: function() { var target = document.querySelector('.circle-box') target.classList.add('active') var isFollow = true; document.addEventListener('mousemove', function(event) { var x = event.clientX, y = event.clientY; if (isFollow) { TweenMax.to(target, .1, { x: x, y: y, force3D: true }) } }, false) document.addEventListener('mouseenter', function() { target.classList.add('active') }, false) }, mouseCircle2: function() { if (shuwon.percent == 0) { $('.circle-box').css('display', 'none') $('.circle-box2').css('display', 'block') var target = document.querySelector('.circle-box2') target.classList.add('active') var isFollow = true; document.addEventListener('mousemove', function(event) { var x = event.clientX, y = event.clientY; if (isFollow) { TweenMax.to(target, .1, { x: x - 50, y: y - 10, force3D: true }) } }, false) document.addEventListener('mouseenter', function() { target.classList.add('active') }, false) } else { $('.circle-box').css('display', 'block') $('.circle-box2').css('display', 'none') var target = document.querySelector('.circle-box') target.classList.add('active') var isFollow = true; document.addEventListener('mousemove', function(event) { var x = event.clientX, y = event.clientY; if (isFollow) { TweenMax.to(target, .1, { x: x, y: y, force3D: true }) } }, false) document.addEventListener('mouseenter', function() { target.classList.add('active') }, false) } }, nomoralBanner: function() { $(".index__hero__visual__pager__page").eq(0).addClass("active"); var t = $(".index__hero__visual__images__image"), a = t.length, d = 0; var timer = setInterval(function() { next() }, 5000); function next() { d = ++d > a - 1 ? 0 : d; e() } function prev() { d = --d < 0 ? a - 1 : d; e() } $(".index__hero__visual__pager__page").click(function() { d = $(this).index(); e() }); function e() { clearInterval(timer); $(".index__hero__visual").attr("data-position", d); $(".index__hero__visual__pager__page").eq(d).addClass("active").siblings().removeClass("active"); timer = setInterval(function() { next() }, 5000) } }, videoList: function() { var myVideo = document.getElementById("video"); $(".videoList ul li").click(function() { myVideo.setAttribute("src", $(this).attr("data-url")); $(".lightBox").addClass("active"); myVideo.play(); }) $(".videoCloseBtn").click(function() { $(".lightBox").removeClass("active"); myVideo.pause(); }) }, /** *閲囩敤swiper鐨刦ade鍒囨崲 * * 鏃犻渶浼犲弬 * 鍏煎绉诲姩绔 * */ swiperFade: function() { new Swiper('.swiper-container.swiperNomal', { autoplay: { delay: 3000, disableOnInteraction: false, }, spaceBetween: 30, loop: true, effect: 'fade', speed: 500, pagination: { el: '.swiperNomal .swiper-pagination', clickable: true, renderBullet: function(index, className) { return '0' + (index + 1) + ''; }, }, navigation: { nextEl: '.btnBox .next', prevEl: '.btnBox .prev', }, }); }, /** *閲囩敤swiper鐨刡anner鍒囨崲 * * 鏃犻渶浼犲弬 * 鍏煎绉诲姩绔 * */ swiperBanner: function() { var interleaveOffset = 0.5; var swiperOptions = { loop: true, speed: 1000, autoplay: true, grabCursor: true, watchSlidesProgress: true, mousewheelControl: true, keyboardControl: true, navigation: { nextEl: ".swiper-button-next.next", prevEl: ".swiper-button-prev.prev" }, pagination: { el: '.swiper-pagination.bannerDot', }, on: { progress: function() { var swiper = this; for (var i = 0; i < swiper.slides.length; i++) { var slideProgress = swiper.slides[i].progress; var innerOffset = swiper.width * interleaveOffset; var innerTranslate = slideProgress * innerOffset; swiper.slides[i].querySelector(".slide-inner").style.transform = "translate3d(" + innerTranslate + "px, 0, 0)"; } }, touchStart: function() { var swiper = this; for (var i = 0; i < swiper.slides.length; i++) { swiper.slides[i].style.transition = ""; } }, slideChange: function() { $('.jgs a').eq(this.activeIndex - 1).addClass("active").siblings().removeClass("active"); }, setTransition: function(speed) { var swiper = this; for (var i = 0; i < swiper.slides.length; i++) { swiper.slides[i].style.transition = speed + "ms"; swiper.slides[i].querySelector(".slide-inner").style.transition = speed + "ms"; } } } }; var swiper = new Swiper(".swiper-container.swiperBanner", swiperOptions); }, /** *鍥炲埌椤堕儴 * * 鏃犻渶浼犲弬 * 鍏煎绉诲姩绔 * */ backTop: function() { $("body").append('