var isMobile = false; // <=1024为移动端 var w_width = 0; // 可视区域宽 var w_height = 0; // 可视区域高 var $mtoph = 0; // 类似header高 var $menuBtn = $('.menu-handler'); // 手机导航按钮 var $menuBox = $('.menuBox'); // 手机导航 var navItem = 0; // 导航是否展开标识 // 移动端事件和PC事件的切换 var _mousemove; var _click; var _mousedown; var _mouseup; if (Modernizr.touch) { _mousemove = 'touchmove'; _click = 'touchend'; _mousedown = 'touchstart'; _mouseup = 'touchend'; _mouseenter = 'touchend'; } else { _mousemove = 'mousemove'; _click = 'click'; _mousedown = 'mousedown'; _mouseup = 'mouseup'; _mouseenter = 'mouseenter'; } function pageBox() { w_width = $(window).width(); w_height = $(window).height(); if ($('.mtop')) { $mtoph = $('.mtop').height(); } isMobile = w_width <= 1024; } pageBox(); $(window).resize(function () { pageBox(); }); function showBackTop() { var ST = $(window).scrollTop(); if (ST > $mtoph) { $('#top').removeClass('hide'); } else { $('#top').addClass('hide'); } } $(function () { showBackTop(); // $(".header .nav li").mouseenter(function () { // var num = $(this).data("num"); // if (num === 4) { // $(".pro-nav").stop().fadeIn(); // } else { // $(".pro-nav").stop().fadeOut(); // } // }); // $(".header").mouseleave(function () { // $(".pro-nav").stop().fadeOut(); // }); // $('.header') // .mousemove(function (e) { // if ($(e.target).parents('.nav').length) { // var num = $(e.target).data('num'); // if (num === 4) { // $('.pro-nav').addClass('show'); // } else { // $('.pro-nav').removeClass('show'); // } // } else if (!$(e.target).parents('.pro-nav').length) { // $('.pro-nav').removeClass('show'); // } // }) // .mouseleave(function () { // $('.pro-nav').removeClass('show'); // }); // $('.course-filter-nav .nav li > p').bind(_click, function () { // var $parent = $(this).parent(); // var $options = $parent.find('.options'); // var act = $parent.hasClass('act'); // if (!act) { // $('.course-filter-nav .nav li').removeClass('act'); // $('.course-filter-nav .nav .options').stop().slideUp(); // $parent.addClass('act'); // $options.stop().slideDown(); // } else { // $parent.removeClass('act'); // $options.stop().slideUp(); // } // }); // $('.page-menu-btn').bind(_click, function (e) { // e.preventDefault(); // var act = $(this).hasClass('act'); // var $menu = $(this).parent().find('.page-menu-box'); // if (act) { // $(this).removeClass('act'); // $menu.removeClass('show'); // } else { // $(this).addClass('act'); // $menu.addClass('show'); // } // }); // gotoDestination(); // setListDelay('.back-wrap2 li'); // setListDelay('.feature-nav li'); // setListDelay('.cul-back li'); // setListDelay('.pnav li'); // setLastClass('.f-nav li'); // setLastClass('.f-service li'); // toggleActive('.go-btns a'); // toggleActive('.btn-collect'); // setListDelay('.f-service li', 200, 200); // setListDelay('.fixctas li', 200, 200); $('.header .nav .more').mouseenter(function () { $('.moreNav').stop(true, true).slideDown(); }); $('.header').mouseleave(function () { $('.moreNav').stop(true, true).slideUp(); }); $('.agreeBtn').bind(_click, function () { $(this).toggleClass('act'); }); // $('input[type=radio]').click(function () { // $('input[type=radio]').parent().removeClass('checked'); // $(this).parent().addClass('checked'); // }); // $('input[type=file]').change(function (e) { // var files = e.target.files; // var imgEle = $(this).parent().next('.uploadImg'); // if (!imgEle.length) { // imgEle = $(this).parents('.de-picture-upload').find('.uImg'); // } // var isHide = imgEle.is(':hidden'); // if (isHide) { // imgEle.show(); // } else { // imgEle.html(''); // } // for (var i = 0; i < files.length; i++) { // var imgUrl = URL.createObjectURL(files[i]); // imgEle.append('
'); // } // }); $('.shareBtn').bind(_click, function (e) { e.preventDefault(); $('.ly-share').stop().fadeIn().addClass('show'); }); $('.ly-close').bind(_click, function (e) { e.preventDefault(); $('.ly-share').stop().fadeOut().removeClass('show'); }); $('.menu-handler').bind(_click, function (e) { e.preventDefault(); var active = $(this).hasClass('active'); if (active) { $(this).removeClass('active'); $('.m-header').removeClass('active'); $('.footer .ft').removeClass('active'); } else { $(this).addClass('active'); $('.m-header').addClass('active'); $('.footer .ft').addClass('active'); } }); closeModal('.ly-close'); // openModal('.openModalBtn'); // $('.multipleSelect .options a').on(_click, function () { // var isSelected = $(this).hasClass('selected'); // var parent = $(this).parents('.multipleSelect'); // var textEle = parent.find('.se'); // var placeholder = parent.find('.placeholder'); // var currText = $(this).text(); // var texts = textEle.text(); // if (isSelected) { // $(this).removeClass('selected'); // var arr = texts.split(';'); // var newText = ''; // for (var i = 0; i < arr.length; i++) { // if (arr[i] !== currText && arr[i]) { // newText = arr[i] + ';'; // } // } // textEle.text(newText); // if (!newText) { // placeholder.show(); // } // } else { // $(this).addClass('selected'); // if (!texts) { // placeholder.hide(); // } // textEle.text(texts + currText + ';'); // } // }); // $('.multipleSelect .se').on(_click, function () { // var parent = $(this).parents('.multipleSelect'); // $('.multipleSelect').removeClass('focus'); // $('.multipleSelect').find('.options').stop(true, true).slideUp(); // parent.addClass('focus'); // parent.find('.options').stop(true, true).slideDown(); // }); // $(document).on(_click, function (e) { // var curr = $(e.target).hasClass('multipleSelect'); // var parents = $(e.target).parents('.multipleSelect'); // if (!curr && !parents.length) { // $('.multipleSelect').removeClass('focus'); // $('.multipleSelect').find('.options').stop(true, true).slideUp(); // } // }); // $('.header .pro').mouseenter(function() { // $('.pull-nav').stop().fadeIn().addClass('active'); // $(this).addClass('show'); // }); // $('.pro-nav-list li').each(function(i, e) { // $(this).css({ 'transition-delay': 200*i + 'ms' }); // }); // $('.header').mouseleave(function() { // $('.pull-nav').stop().fadeOut(function() { // $(this).removeClass('active'); // }); // $('.header .pro').removeClass('show'); // }); // $('.navMobile dd').each(function(i, e) { // $(this).css({ 'transition-delay': 300 + 100*i + 'ms' }); // }); // $('.navMobile dd p a').bind(_click, function (e) { // if($(this).parent().next('.mtnav').size() >= 1){ // if(!$(this).hasClass('act')){ // e.preventDefault(); // $('.navMobile dd p a').removeClass('act'); // $('.mtnav').stop().slideUp(300); // $(this).addClass('act'); // $(this).parent().next('.mtnav').stop().slideDown(300); // }else{ // $(this).removeClass('act'); // $(this).parent().next('.mtnav').stop().slideUp(300); // } // } // }); // $('.omenu > li > a').bind(_click, function(e) { // var $tmenu = $(this).next('.tmenu'); // var active = $tmenu.hasClass('active'); // var len = $tmenu.length; // var menuActive = $('.omenu').hasClass('menuActive'); // if (len && !active) { // e.preventDefault(); // if (menuActive) { // $('.tmenu').hide().removeClass('active'); // $('.omenu > li > a').removeClass('act'); // } else { // $('.omenu').addClass('menuActive'); // } // $tmenu.show(function() { // $(this).addClass('active'); // }); // $(this).addClass('act'); // } // }); // $('.tmenu .back').bind(_click, function(e) { // e.preventDefault(); // $('.omenu').removeClass('menuActive'); // var $tmenu = $(this).parents('.tmenu'); // $tmenu.hide().removeClass('active'); // $tmenu.siblings('a').removeClass('act'); // }); // $('.omenu > li').each(function(i) { // var $tmenu = $(this).find('.tmenu'); // var len = $tmenu.length; // if (len) { // setListDelay($tmenu.find('div'), 100, 400); // } // }); // $menuBtn.bind(_click, function () { // if (navItem == 0) { // $(this).addClass("active"); // $menuBox.show().stop(false,false).animate({top:0}).addClass('show'); // navItem = 1; // } else { // $(this).removeClass("active"); // $menuBox.stop(false,false).animate({top:-100+"%"},function(){ // $(this).hide().removeClass('show'); // }); // navItem = 0; // } // }); if ($('.splwo').length !== 0) { $('.splwo').each(function (i) { splitWords($(this)); }); } // 友情链接 // var isopen = 0; // $('.friendship-link').bind(_click, function(){ // if(isopen==0){ // isopen = 1; // $(this).addClass('act'); // $('.friendship-link .k').stop().slideDown(300); // }else{ // isopen = 0; // $(this).removeClass('act'); // $('.friendship-link .k').stop().slideUp(300); // } // }); // $('.friendship-link').mouseleave(function(){ // isopen = 0; // $('.friendship-link').removeClass('act'); // $('.friendship-link .k').stop().slideUp(300); // }); // 手机导航 $('.navMobile dd > p > a').bind(_click, function (e) { var $mtnav = $(this).parent().next('.mtnav'); if ($mtnav.size() >= 1) { if (!$(this).hasClass('act')) { e.preventDefault(); $('.navMobile dd > p > a').removeClass('act'); $('.mtnav').stop().slideUp(300); $(this).addClass('act'); $mtnav.stop().slideDown(300); } else { $(this).removeClass('act'); $mtnav.stop().slideUp(300); } } }); $menuBtn.bind(_click, function () { var w = $menuBox.width(); if (navItem == 0) { $('html').addClass('open'); $(this).addClass('active'); $menuBox.show().stop(false, false).animate({ top: 0 }); navItem = 1; } else { $('html').removeClass('open'); $(this).removeClass('active'); $menuBox.stop(false, false).animate({ top: '-100%' }, function () { $(this).hide(); }); navItem = 0; } }); $(window).scroll(function () { // page banner // var windowTop = $(window).scrollTop(); // if (windowTop < w_height && !isMobile) { // $(".pbanner .pic2 img").css("transform", "translate(0px," + windowTop / 1.5 + "px)"); // } showBackTop(); // intoShowLeaveHide('.pnav', '.container', '.footer'); // intoShowLeaveHide('.feature-nav', '.container', '.footer'); // intoShowLeaveHide('.back-wrap2', '.container', '.footer'); // intoShowLeaveHide('.cul-back', '.container', '.footer'); }); // Imitation placeholder function $('.s-input').bind({ focus: function () { if (this.value == this.defaultValue) { this.value = ''; } }, blur: function () { if (this.value == '') { this.value = this.defaultValue; } }, }); // Back to top $('#top').bind(_click, function () { $('html,body').stop().animate({ scrollTop: 0 }, 800); }); // Scroll a screen $('#mouse').bind(_click, function () { $('html,body').stop().animate({ scrollTop: w_height }, 800); }); // video play $('.videoBox .close, .videoBox .videoBg').bind(_click, function () { objplay.stop(); $('.videoBox').hide(); $('#videoPlay').html(''); }); $('.vi-btn').bind(_click, function (e) { e.stopPropagation(); e.preventDefault(); var img = $(this).attr('data-video-image'); var video = $(this).attr('data-video-url'); Video.load({ vcontainer: 'videoPlay', vfimg: img, vfiles: video, isautoplay: 'true', }); $('.videoBox').fadeIn(); }); // weixin $('.wxBtn').bind(_click, function (e) { e.preventDefault(); if (isMobile) { setPopUp($(this), '请扫描二维码'); } }); function setPopUp(obj, title) { var str = '