var shuwon = { percent: 0, timers: "", init: function (e) { util.backTop() util.isTop() util.toastInit() $(".lazy").lazyload({ effect: "fadeIn" }); //杩斿洖椤堕儴 $('footer .trip .back').click(function () { $('body,html').animate({ scrollTop: 0 }, 500) }); if ($(window).width()>=1024) { $('nav ').hover(function () { $('.nav').addClass('active') }, function (e) { $('.nav').removeClass('active') }); }else{ $(".sn").click(function(e){ $("nav ul .level1 ul,.sn").removeClass("active"); e.preventDefault(); $(this).addClass("active") $(this).next().addClass("active"); }) } $(".menu_btn").click(function(){ $(this).toggleClass("active"); if ($(this).hasClass("active")) { $(".nav-right").addClass("active"); }else{ $(".nav-right").removeClass("active"); } }) $(".sub_banner").addClass("active"); $(window).scroll(function () { //鑾峰彇婊氬姩鏉℃粴鍔ㄧ殑浣嶇疆 var scrollTop = $(window).scrollTop(); if ($(window).width()>=1024) { if (scrollTop > 0) { $('nav').addClass('navActive'); $('nav ul .level1 a').addClass('navColor'); } else { $('nav').removeClass('navActive'); $('nav ul .level1 a').removeClass('navColor'); } } if($(".banner_img").length > 0){ $(".banner_img .s").css({"-webkit-transform": "translateY(" + scrollTop * 0.5 + "px)"}) } }); var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 100, mobile: true, live: true }).init(); $(".sub_title").each(function(i) { var splitone = new SplitText($(this).find("b"), {type: 'chars, words',charsClass: 'chars', linesClass: 'lines'}); }); }, single: function () { }, /** * 椤甸潰鍔犺浇瀹屾瘯 */ loaded: function () { }, banner: function () { var s = 0; var n = 0; setInterval(function () { n = s; s = ++s > 2 ? 0 : s; // main_visual_text(n, s, false); $(".slogan ul li").eq(s).addClass("active").siblings().removeClass("active"); }, 5000) function main_visual_text(current_slide, new_slide, first) { var delay = (first === true) ? 0 : .1; var tl = new TimelineMax({ delay: delay, paused: 1 }); var $list_item = $('.lis:first-child'); var title, title_chars, p, p_lines, $btn; TweenMax.set($list_item.find('.b:first'), { autoAlpha: 1 }); if (first) { new_slide = 0; title = new SplitText($('.b:first'), { type: "chars, lines", charsClass: 'chars', linesClass: 'lines' }); title_chars = title.chars; $btn = $('.main_visual_text_item_content_btn:first'); $('.lis:first-child').clone().addClass('slg').appendTo('.slogan'); } else { // hide tl.staggerTo($('.lis:first-child').find('.chars'), 0.5, { y: 80, ease: Power2.easeIn }, 0.04, 0, function () { var next_title = $('.lis:eq(' + new_slide + ')').find('.b').text(); var $title = $list_item.find('.b'); if (new_slide === 0) { next_title = $('.slg').find('.b').text(); } $title.text(next_title); title = new SplitText($('.b:first'), { type: "chars, lines", charsClass: 'chars', linesClass: 'lines' }); title_chars = title.chars; TweenMax.staggerFrom(title_chars, 0.5, { y: 80, ease: Power2.easeOut }, 0.04); }); } tl.play(); } }, moon:function(){ var s = 0; var n = 0; setInterval(function () { n = s; s = ++s > 2 ? 0 : s; main_visual_text(n, s, false); }, 5000) main_visual_text(0, null, true); function main_visual_text(current_slide, new_slide, first) { var delay = (first === true) ? 0 : .1; var tl = new TimelineMax({ delay: delay, paused: 1 }); var $list_item = $('.lis:first-child'); var title, title_chars; TweenMax.set($list_item.find('.b:first'), { autoAlpha: 1 }); if (first) { new_slide = 0; title = new SplitText($('.b:first'), { type: "chars, lines", charsClass: 'chars', linesClass: 'lines' }); title_chars = title.chars; $('.lis:first-child').clone().addClass('slg').appendTo('.texts'); } else { tl.staggerTo($('.lis:first-child').find('.chars'), 0.5, { y: 80, ease: Power2.easeIn }, 0.03, 0, function () { var next_title = $('.lis:eq(' + new_slide + ')').find('.b').text(); var $title = $list_item.find('.b'); if (new_slide === 0) { next_title = $('.slg').find('.b').text(); } $title.text(next_title); title = new SplitText($('.b:first'), { type: "chars,lines", charsClass: 'chars', linesClass: 'lines' }); title_chars = title.chars; TweenMax.staggerFrom(title_chars, 0.5, { y: 80, ease: Power2.easeOut }, 0.03); }); } tl.play(); } }, index: function () { if ($("body").hasClass("moon")) { shuwon.moon(); }else{ shuwon.banner(); } $(".picBox,.slogan").addClass("active"); var $scene = $('#scene') $scene.parallax(); var service = new Swiper('#service',{ autoplay: { delay: 5000, disableOnInteraction: false, }, speed: 700, allowTouchMove: true, lazy: { loadPrevNext: true, loadPrevNextAmount: 3, }, centeredSlides: false, spaceBetween : 20, slidesOffsetBefore: 0, loop: false, slidesPerView : 5, breakpoints: { //褰撳搴﹀皬浜庣瓑浜?40 767: { slidesPerView: 2, spaceBetween : 10 }, 1023: { slidesPerView: 4, spaceBetween : 10 } }, on: { slideChangeTransitionEnd: function(){ this.slides.transition(this.params.autoplay.delay+this.params.speed).transform('translate3d(-60px, 0, 0)'); }, slideChangeTransitionStart: function(){ this.slides.transition(this.params.speed).transform('translate3d(0, 0, 0)'); }, }, pagination: { el: '.swiper-pagination.service-nav', clickable :true, renderBullet: function (index, className) { return '
'; }, } }); var options = { useEasing: true, useGrouping: true, separator: ',', decimal: '.', prefix: '', suffix: '' }; var yearNum = new CountUp("yearNum", 0, 21, 0, 2.5, options); var Resource = new CountUp("Resource", 0, 10000, 0, 2.5, options); var area = new CountUp("area", 0, 996, 0, 2.5, options); var people = new CountUp("people", 0, 330, 0, 2.5, options); var zy = new CountUp("zy", 0, 5000, 0, 2.5, options); var _h = $(window).height() $(window).scroll(function () { var topNumber = $('.course .content').offset().top var scrollTop = $(window).scrollTop(); $(".banner").css({"-webkit-transform": "translateY(-" + scrollTop * 0.1 + "px)"}) if (topNumber >= scrollTop && topNumber < (scrollTop + _h)) { yearNum.start(); Resource.start(); area.start(); people.start(); zy.start(); } }) //榧犳爣鍥炬爣 var Cursor = { position: { x: 0, y: 0 }, dom: '', target: '', init: function (target, elm) { this.target = document.querySelector(target); this.dom = document.querySelector(elm); this.eventHander() this.ani() }, show: false, dragg: false, update: function (x, y) { }, ani: function () { requestAnimationFrame(Cursor.ani) Cursor.render() }, render: function () { if (Cursor.show) { /** @type {HTMLElement} */ Cursor.target.classList.add('show-pointer') TweenMax.to(this.target, .25, { left: Cursor.position.x + 'px', top: Cursor.position.y + 'px' }) } else { Cursor.target.classList.remove('show-pointer') } }, eventHander: function () { var self = this this.dom.addEventListener('mousemove', function (e) { self.position.x = e.clientX self.position.y = e.clientY }, false) this.dom.addEventListener('mousedown', function (e) { $(self.target).addClass('active') }, false) this.dom.addEventListener('mouseup', function (e) { $(self.target).removeClass('active') }, false) this.dom.addEventListener('mouseleave', function (e) { self.show = false // console.log('leave') }, false) this.dom.addEventListener('mouseenter', function (e) { self.show = true // console.log('in') }, false) } } Cursor.init('.cursor', '.Must') }, aboutSingle: function () { var lis = $('.HistoricalRiver li') var img_ = document.querySelector('.historyBasic img'), pixe = img_.width / img_.naturalWidth; var tr = document.querySelector('.HistoricalRiver') window.addEventListener('scroll',function () { var top = tr.getBoundingClientRect().top; var mask = document.querySelector('.historyMask'); var title = document.querySelector('.introduction-course .inC-title').getBoundingClientRect(); var ul = document.querySelector('.historyListUl'); // 绾㈣壊閮ㄥ垎鍔ㄧ敾 if(top <= window.innerHeight / 2){ mask.style.height = Math.abs(top - window.innerHeight / 2) * tr.offsetHeight / (tr.offsetHeight - window.innerHeight / 2) + 'px'; }else{ mask.style.height = 0 + 'px'; } // 娴姩鏍囬 if(tr.getBoundingClientRect().bottom <= window.innerHeight){ if(ul.style.position !== 'absolute'){ console.log(Math.abs(top),ul.getBoundingClientRect().top) ul.style.position = 'absolute'; ul.style.top = window.innerWidth * 0.5 + Math.abs(top) + 'px'; } } else if(title.bottom < 150){ if( ul.style.position !== 'fixed'){ ul.style.top = window.innerWidth * .1 + 'px'; ul.style.position = 'fixed'; } }else{ ul.style.position = 'absolute'; ul.style.top = '0'; } // 鏄剧ず骞翠唤 document.querySelectorAll('.HistoricalRiver li').forEach(function (item,index) { var t = item.getBoundingClientRect().top if(t <= mask.getBoundingClientRect().bottom - 100){ item.classList.add('active') activeId = index; $('.HistoricalRiver li').eq(index).addClass("show").siblings().removeClass("show"); update_() }else{ item.classList.remove('active'); item.classList.remove('show') if(index === 0){ activeId = index; update_() } } }) },false); var activeId = 0 var lis_ = $('.historyListUl li') $('.historyListUl .btnIcon.btnRight').click(function () { if(activeId < lis_.length - 1){ activeId += 1; $('.historyListUl .btnIcon.btnLeft').show(); update_() } }); $('.historyListUl .btnIcon.btnLeft').click(function () { if(activeId > 0){ activeId -= 1; $('.historyListUl .btnIcon.btnRight').show(); update_() } }); function update_() { lis_.eq(activeId).addClass('active').siblings().removeClass('active'); if(activeId === lis_.length - 1){ console.log('hide') $('.historyListUl .btnIcon.btnRight').hide(); $('.historyListUl .btnIcon.btnLeft').show(); }else if(activeId === 0){ $('.historyListUl .btnIcon.btnLeft').hide(); $('.historyListUl .btnIcon.btnRight').show() }else{ $('.historyListUl .btnIcon.btnLeft').show(); $('.historyListUl .btnIcon.btnRight').show() } } }, mediaFace: function (e) { $(".a").click(function () { $(this).hide(); $(".d").show(); }) }, mediaSubgke: function (e) { $(".a").click(function () { $(this).hide(); $(".d").show(); }) }, contactSingle: function () { var map = new BMap.Map("allmap"); var point = new BMap.Point(104.071689, 30.596284); map.centerAndZoom(point, 15); var myIcon = new BMap.Icon("/static/assets/images/map_icon.png", new BMap.Size(60,60)); var marker = new BMap.Marker(point,{icon:myIcon}); // 鍒涘缓鏍囨敞 var sContent =""; var infoWindow = new BMap.InfoWindow(sContent); // 鍒涘缓淇℃伅绐楀彛瀵硅薄 //map.openInfoWindow(infoWindow,point); //寮€鍚俊鎭獥鍙 marker.addEventListener("click", function(){ map.openInfoWindow(infoWindow,point); //寮€鍚俊鎭獥鍙 }); map.addOverlay(marker); // 灏嗘爣娉ㄦ坊鍔犲埌鍦板浘涓 }, hr:function(){ $(".jtop").click(function(){ $(this).toggleClass("active"); if ($(this).hasClass("active")) { $(this).addClass("active"); $(this).next().addClass("active"); }else{ $(this).removeClass("active"); $(this).next().removeClass("active"); } }) }, /** * 鍊掕鏃 */ countDownTime: function () { isClick = false; $('.yzmBtn').addClass("enable"); $('.yzmBtn').addClass("active").html('60绉掑悗閲嶆柊鑾峰彇') var waitTime, currTime = 59; var interval = setInterval(function () { shuwon.timeChange(currTime); currTime--; if (currTime < 0) { clearInterval(interval); currTime = waitTime; } }, 1000); }, /** *鑾峰彇鏁版嵁 * * @param {String} url 浼犲叆鐨勬暟鎹帴鍙 * @param {Object} para 浼犲叆鐨勫弬鏁 * @param {Object} callback 杩斿洖 */ getDataForApi: function (type, url, para, callback) { $.ajax({ type: type, data: para, url: window.location.protocol + '//' + window.location.host + url, dataType: 'json', success: function (data) { callback(data) }, error: function (e) { console.log(e, "鏁版嵁鍔犺浇閿欒") } }) }, } shuwon.init()