function stopbubble(e) { // 濡傛灉浼犲叆浜嗕簨浠跺璞★紝閭d箞灏辨槸闈瀒e娴忚鍣? if (e && e.stoppropagation) { //鍥犳瀹冩敮鎸乄3c鐨剆toppropagation()鏂规硶 e.stoppropagation(); } else { //鍚﹀垯鎴戜滑浣跨敤ie鐨勬柟娉曟潵鍙栨秷浜嬩欢鍐掓场 window.event.cancelbubble = true; } } //// 鏄惁鏈塼ouch浜嬩欢 var tap = 'click'; $(window).load(function() { var istouch = "ontouchstart" in document ? true : false; if (istouch) { tap = 'touchstart'; } else { tap = 'click'; } return tap; }); //瀹炵幇婊氬姩鏉℃棤娉曟粴鍔? var mo = function(e) { e.preventdefault(); }; /***绂佹婊戝姩***/ function scrollstop() { document.body.style.overflow = 'hidden'; document.addeventlistener("touchmove", mo, false); //绂佹椤甸潰婊戝姩 } /***鍙栨秷婊戝姩闄愬埗***/ function scrollmove() { document.body.style.overflow = ''; //鍑虹幇婊氬姩鏉? document.removeeventlistener("touchmove", mo, false); } /*** // 椤甸潰婊氬姩wow.js鍐峣e9浠ヤ笂寮曠敤 $(window).load(function() { var wow = new wow({ boxclass: 'wow', animateclass: 'animated', offset: 100, mobile: true, live: true }); if (!(/msie [6|7|8|9]/i.test(navigator.useragent))) { wow.init(); }; }); ***/ // 婊氬姩鏉″紩鐢? $(window).load(function() { if ($('.scrollbox').length > 0) { $('.scrollbox').mcustomscrollbar(); } if ($('.scrollbox2').length > 0) { $('.scrollbox2').mcustomscrollbar({ axis: "x", horizontalscroll: true, advanced: { autoscrollonfocus: true, autoexpandhorizontalscroll: true } }); } }) $(window).resize(function() { if ($('.scrollbox').length > 0) { $('.scrollbox').mcustomscrollbar('update'); } if ($('.scrollbox2').length > 0) { $('.scrollbox2').mcustomscrollbar('update'); } }) /// 绉诲姩绔ご閮ㄥ浐瀹? var headfixedfn = function() { var ww = $(window).width(), hh = $('.header').height(); if (ww < 992) { $('.header').addclass('fixed'); $('.head-place').height(hh); } else { $('.header').removeclass('fixed'); $('.head-place').height(0); } } $(window).load(function() { headfixedfn(); }); $(window).resize(function() { headfixedfn(); }); /// 绉诲姩绔鑸脊妗? $('.head-nav-open').on(tap, function() { var hh = $('.header').height(); $(this).addclass('active'); $('.pop-nav-box').css('padding-top', hh).slidedown(350, function() { $('.head-nav-close').show(); }); scrollstop(); }); $('.head-nav-close').on(tap, function() { $('.head-nav-open').removeclass('active'); $('.pop-nav-box').slideup(350, function() { $('.pop-nav-list li').removeclass('active'); $('.pop-subnav-list').hide(); $('.head-nav-close').hide(); }); scrollmove(); }); $('.pop-nav-list .menu-level1 .arrow').on(tap, function() { var $li = $(this).parents('li'); $li.toggleclass('active') .find('.pop-subnav-list').slidetoggle(300).end() .siblings('li').removeclass('active').find('.pop-subnav-list').slideup(300); }); /// 澶撮儴瀵艰埅瀵艰埅fn function navchangefn() { $('.pop-nav-box').hide(); $('.pop-nav-list li').removeclass('active'); $('.pop-subnav-list').hide(); $('.head-nav-close').hide(); $('.head-nav-open').removeclass('active'); scrollmove(); } $(window).resize(function() { var ww = $(window).width(); if (ww > 991) { navchangefn(); } }); $('.main-box').on(tap, function() { navchangefn(); }) /// 椤堕儴鎼滅储妗? $('.head-tool-box .head-btn-sch').on(tap, function(e) { stopbubble(e); $('.head-sch-box').stop(true, true).slidetoggle(350); navchangefn(); }); $('.head-sch-box').on(tap, function(e) { stopbubble(e); }); $(document).on(tap, function() { $('.head-sch-box').slideup(350); }) /// 寮瑰嚭妗嗗嚭鐜? function popshowfn(obj, fn) { var $obj = $(obj), $zhe = $obj.find('.pop-zhe'), $inner = $obj.find('.pop-inner'), popfn = fn; $obj.fadein(200, function() { $zhe.show(); $inner.fadein(200, function() { $obj.addclass('open'); if (popfn != null) popfn(); }); }) } /// 鎻愮ず寮规鍑虹幇 function poptipsfn(state, desc) { var state = state, /// 鎻愮ず鐘舵€? desc = desc; /// 鎻愮ず璇彞 var $obj = $('.pop-tips-box'); switch (state) { case 'success': $obj.removeclass('error warning word'); $obj.addclass('success'); //// 鎴愬姛鎻愮ず妗? break; case 'error': $obj.removeclass('success warning word'); $obj.addclass('error'); //// 閿欒鎻愮ず妗? break; case 'warning': $obj.removeclass('error success word'); $obj.addclass('warning'); //// 璀﹀憡鎻愮ず妗? break; default: $obj.removeclass('error warning success'); $obj.addclass('word'); //// 璇彞鎻愮ず妗? break; } $obj.find('.tip-desc').html(desc); popshowfn($obj); } /// 寮规娑堝け $('.pop-close, .pop-cancel').on(tap, function() { $(this).parents('.pop-box').removeclass('open').fadeout(350); }); //// 鍐呴〉宸︿晶瀵艰埅鍥哄畾 function insidenavfn() { var le = $('.inside-left-box').offset().left; if ($('.inside-subnav-pc').hasclass('isstuck')) { $('.inside-subnav-pc').css('left', le); } else { $('.inside-subnav-pc').css('left', 0); } } $(document).ready(function() { if ($('.inside-subnav-pc').length > 0) { $('.inside-subnav-pc').stickup(); insidenavfn(); $(window).scroll(function() { insidenavfn(); }) } }); /// 鍐呴〉绉诲姩绔簩绾у鑸? $('.inside-subnav-ph .subnav-current').on(tap, function() { $(this).siblings('.subnav-dropdown').slidetoggle(350); }) //// 閫夐」鍗? $('.tab').on(tap, function() { $(this).addclass('active').siblings('.tab').removeclass('active'); }) /// 閿氱偣璺宠浆 function anchormove(id) { var $obj = $(id); var oh = $obj.offset().top - parseint($('.header').outerheight()) - 20; $('html,body').animate({ scrolltop: oh }, 300); } /// 鍙戝睍鍘嗙▼鏃堕棿杞挱 $(document).ready(function() { if ($('.history-tab-box .swiper-slide').length > 0) { if (!(/msie [6|7|8|9]/i.test(navigator.useragent))) { var histtabswip = new swiper('.history-tab-box', { loop: false, slidesperview: 4, spacebetween: 8, navigation: { nextel: '.history-tab-ctrl.next', prevel: '.history-tab-ctrl.prev', }, preventclicks: true, breakpoints: { 570: { slidesperview: 3 }, 400: { slidesperview: 2 } }, on: { init: function() { $(this.slides[0]).addclass('active'); }, tap: function(event) { var $slide = $(this.clickedslide); $slide.addclass('active').siblings().removeclass('active'); }, resize: function() { this.update(); } } }); } else { jquery('.history-list-hd').slide({ maincell: '.history-tab-box ul', prevcell: '.history-tab-ctrl.prev', nextcell: '.history-tab-ctrl.next', effect: 'left', vis: 4, autopage: true, pnloop: false }); histtabfn(); $(window).resize(function() { histtabfn(); }) $('.history-tab-box .swiper-slide').on(tap, function() { $(this).addclass('active').siblings().removeclass('active'); }) } } }); function histtabfn() { var hbw = parsefloat($('.history-tab-box').width()); var htw = (hbw - 8 * 3) / 4; $('.history-tab-box .swiper-slide').width(htw); } //// 鍖呮€昏繍钀ュ脊鍑哄眰鍏抽棴 $('.pops-box').on(tap, function() { $(this).stop(true, true).animate({ top: "-100%" }, 500, function() { scrollmove(); }); }) $('.pops-main').on(tap, function(e) { stopbubble(e); }) $('.pops-box .pops-close').on(tap, function() { $(".pops-box").stop(true, true).animate({ top: "-100%" }, 500, function() { scrollmove(); }); }); //// 鍙戝睍鍘嗙▼宸﹀彸绠ご $(window).load(function() { var len = $(".history-tab-box .swiper-slide").length; var width = $(document.body).width(); //寰楀埌鍙灞忓箷鐨勫搴? if (width > 570) { if (len < 5) { $(".history-tab-ctrl").hide(); } } else if (440 < width <= 570) { if (len < 4) { $(".history-tab-ctrl").hide(); } } else if (width < 440) { if (len < 3) { $(".history-tab-ctrl").hide(); } } }) //// 鏃呮父鎺ㄨ崘绾胯矾 $(".pc-recom-item-box ul .trl-recom-item").on('mouseenter', function() { $(this).find('.doc-box').stop(true, true).animate({ right: "0%", opacity: 1 }, 300) }).on('mouseleave', function() { $(this).find('.doc-box').stop(true, true).animate({ right: "100%", opacity: 0 }, 300) }); //// 鏂囧寲鏃呮父 function tramapfn(){ var mapw = parseint($('.travel-map-box').width()), maph = parseint($('.travel-map-box').height()), mratio = mapw / 1920; var mt = maph / 2 * (-1); $('.travel-map-box').css('margin-top', mt); $('.travel-map-item').each(function(){ var xyarr = $(this).attr('data-xy').split(','), txtw = parseint($(this).find('.map-title').width()); var x = xyarr[0] * mratio, y = xyarr[1] * mratio, ml = txtw / 2 * (-1); $(this).css({ 'left': x, 'top' : y }); $(this).find('.map-title').css('margin-left', ml); }); } $(window).load(function(){ tramapfn(); }); $(window).resize(function(){ tramapfn(); }); $('.travel-map-item').hover(function(){ $(this).addclass('active').siblings().removeclass('active'); }, function(){ $(this).removeclass('active'); })