$(document).ready(function() { //璇█ $(".Language span").click(function () { $(this).parent().find("dl").stop().slideToggle(); }); //杩斿洖椤堕儴 $(function () { $(".returnTop").click(function () { $("html,body").animate({ scrollTop: 0 }, 500); }); }); fh = $('.topNav').height(); $(window).scroll(function(e){ s = $(document).scrollTop(); if(s > $(window).height()){ $(".backTop").fadeIn(); }else{ $(".backTop").fadeOut(); } if(s > fh){ $('.topNav').addClass('fixed-head'); }else{ $('.topNav').removeClass('fixed-head'); } }); $(function() { $(".backTop").click(function() { $("html,body").animate({ scrollTop: 0 }, 500); }); }); //瀵艰埅涓嬫媺 $(function () { $(".nav li").hover(function () { $(this).children(".navbox").stop(true, true).slideDown(300); }, function () { $(this).children(".navbox").stop(true, true).slideUp(0); }) }); //閫氱敤鍒囨崲 $('.tabSwitch').each(function (index, element) { var obj = $(this); obj.find('.tabTit').children().on('click tab', function () { $(this).addClass('cur').siblings().removeClass('cur'); if (obj.find('.tabBox').children().eq($(this).index()).length > 0) obj.find('.tabBox').children().hide().eq($(this).index()).show(); if (obj.find('.tabBox2').children().eq($(this).index()).length > 0) obj.find('.tabBox2').children().hide().eq($(this).index()).show(); return false; }); obj.find('.tabTit .cur').trigger('tab'); }); $('.tabSwitchHover').each(function (index, element) { var obj = $(this); obj.find('.tabTit').children().on('mouseover tab', function () { $(this).addClass('cur').siblings().removeClass('cur'); if (obj.find('.tabBox').children().eq($(this).index()).length > 0) obj.find('.tabBox').children().hide().eq($(this).index()).show(); if (obj.find('.tabBox2').children().eq($(this).index()).length > 0) obj.find('.tabBox2').children().hide().eq($(this).index()).show(); //return false; }); obj.find('.tabTit .cur').trigger('tab'); }); function menu(){ var width = $(window).width(); if(width < 1000){ $(".menu").addClass("menuNav"); }else{ $(".menu").removeClass("menuNav"); } } menu(); $(window).resize(function(){ menu(); }); $(document).on("click",".menu",function(){ $("body").addClass("z-open"); }) $(".m-nav dl dd ul li").click(function(){ $(this).toggleClass("cur").siblings().removeClass("cur"); $(".m-nav dl dd ul li .sub").stop().hide(); $(".m-nav dl dd ul li.cur").find(".sub").slideDown(); }) $(".m-nav dl dt img.close").click(function(){ $(".mh .menu span").css("opacity",1); $("body").removeClass("z-open"); }); $(".u-mask").click(function(){ $(".mh .menu span").css("opacity",1); $("body").removeClass("z-open"); }); $(".m-nav dl dd.open").click(function(){ var n = $(this).index() - 1; $(".m-nav dl.sign").hide(); $(".m-nav .headerBox-ul").addClass("on"); $(".m-nav .headerBox-ul .headerBox-li-item").css("display","none"); $(".m-nav .headerBox-ul .headerBox-li-item").eq(n).css("display","block"); }); $(".m-nav .headerBox-ul .headerBox-li-item ul li.headerBox-li-back span").click(function(){ $(".m-nav dl.sign").show(); $(".m-nav .headerBox-ul").removeClass("on"); }); }); $(document).ready(function () { //棣栧厛澶囦唤涓媕query鐨刟jax鏂规硶 var _ajax=$.ajax; //閲嶅啓jquery鐨刟jax鏂规硶 $.ajax=function(opt){ //澶囦唤opt涓璭rror鍜宻uccess鏂规硶 var fn = { error:function(XMLHttpRequest, textStatus, errorThrown){}, success:function(data, textStatus){} } if(opt.error){ fn.error=opt.error; } if(opt.success){ fn.success=opt.success; } //鎵╁睍澧炲己澶勭悊 var _opt = $.extend(opt,{ error:function(XMLHttpRequest, textStatus, errorThrown){ //閿欒鏂规硶澧炲己澶勭悊 fn.error(XMLHttpRequest, textStatus, errorThrown); }, success:function(data, textStatus){ //鎴愬姛鍥炶皟鏂规硶澧炲己澶勭悊 fn.success(data, textStatus); }, beforeSend:function(XHR){ //鎻愪氦鍓嶅洖璋冩柟娉 //$('body').append("
姝e湪鍔犺浇,璇风◢鍚?..
"); layer.load(); }, complete:function(XHR, TS){ //璇锋眰瀹屾垚鍚庡洖璋冨嚱鏁 (璇锋眰鎴愬姛鎴栧け璐ヤ箣鍚庡潎璋冪敤)銆 //$("#ajaxInfo").remove();; layer.closeAll('loading'); } }); return _ajax(_opt); }; }); $(document).ready(function(){$("body").on("contextmenu",'video, .playinbox',function(){return false});$('body').on('click','[data-video2],[data-video]',function(){var videosrc=$(this).data('video');if(!videosrc){videosrc=$(this).data('video2')}if(videosrc){if($(this).data('toid')){var obj=$($(this).data('toid'));if(obj.length){var content='
';obj.width(obj.width()).height(obj.height()).html(content);var my_video_2=document.getElementById("my_video_2");my_video_2.addEventListener('loadedmetadata',function(){$('#my_video_2').trigger('loader',my_video_2)});my_video_2.play();return}}var isIOS=false;var isAndroid=false;var isMobile=false;var isWechat=false;if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){isIOS=true}if(/(Android)/i.test(navigator.userAgent)){isAndroid=true}if(/(MicroMessenger)/i.test(navigator.userAgent)&&typeof window.tbs_bridge==="object"){isWechat=true}if(isIOS||isAndroid){isMobile=true}var openW=700;if($(this).data('width')){openW=$(this).data('width')}if(openW>$(window).width()-50){openW=$(window).width()-50}var area=[openW+'px','auto'];if(isMobile){openW=$(window).width()-50;area=[openW+'px','auto']}var withoutvideo=false;if(/(html|player|embed|(.*?)\.([a-z]+)\/video\/)/i.test(videosrc)&&videosrc.substr(-4).toLocaleLowerCase()!=='.mp4'){withoutvideo=true}if(withoutvideo){var frameRatio=Math.max($(window).height()/$(window).width(),0.7);area[1]=(openW*frameRatio)+'px';layer.open({type:1,title:false,area:area,closeBtn:1,shadeClose:false,skin:'yourclass',content:'
',success:function(layero,index){}})}else{var title=false,shadeClose=false;var videocontent='
';if(isWechat){videocontent='
'}layer.open({type:1,title:title,area:area,closeBtn:1,shadeClose:shadeClose,skin:'yourclass',content:videocontent,success:function(layero,index){var my_video_2=document.getElementById("my_video_2");my_video_2.addEventListener('loadedmetadata',function(){var videoW=this.videoWidth;var videoH=this.videoHeight;var videoRatio=videoH/videoW;var newwidth=openW;var newheight=(videoRatio*openW);if($(window).height()-newheight<60){newheight=$(window).height()-60;newwidth=newheight/videoRatio}layer.style(index,{width:newwidth+'px',height:newheight+'px',left:(($(window).width()-newwidth)*0.5)+'px',top:(($(window).height()-newheight)*0.5)+'px'});$('.yourclass').find('.layui-layer-content').height(newheight);$('#my_video_2').trigger('loader',my_video_2)});my_video_2.play();if(isWechat){my_video_2.addEventListener("loadeddata",function(){layer.style(index,{display:'none'})});my_video_2.addEventListener("x5videoexitfullscreen",function(){layer.close(index)})}else if(isMobile){if(my_video_2.requestFullscreen){my_video_2.requestFullscreen()}else if(my_video_2.webkitRequestFullscreen){my_video_2.webkitRequestFullScreen()}else if(my_video_2.mozRequestFullScreen){my_video_2.mozRequestFullScreen()}else{my_video_2.webkitEnterFullscreen();var timer=setInterval(function(){if(!my_video_2.webkitDisplayingFullscreen){clearInterval(timer)}},1000)}var screen_change_events="webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange";$(document).on(screen_change_events,function(){if(!document.webkitIsFullScreen){layer.close(index);$(document).off(screen_change_events)}})}}})}}})}); function CheckSearch(o){ var obj = $(o); obj.find('[type="submit"]').attr('disabled',true); var msg = ''; layer.closeAll('tips'); var searKey = obj.find('[name="searKey"]').val(); if (searKey.length < 1){ msg = '璇疯緭鍏ュ叧閿瘝'; //obj.find('[name="searKey"]').inputError({'err': msg, 'tips': 3, tipsMore: true}); layer.msg(msg); obj.find('[name="searKey"]').focus(); } if (msg.length){ obj.find('[type="submit"]').attr('disabled',false); return false; } return true; } function CheckContact(o){ var obj = $(o); obj.find('[type="submit"]').attr('disabled',true); var msg = ''; layer.closeAll('tips'); var person = obj.find('[name="person"]:checked').length?obj.find('[name="person"]:checked').val():''; var usestr = obj.find('[name="use"]:checked').length?obj.find('[name="use"]:checked').val():''; var person_other = obj.find('[name="person_other"]').val(); var area = obj.find('[name="area"]').val(); var wenti = obj.find('[name="wenti"]').val(); var ask = obj.find('[name="ask"]').val(); var username = obj.find('[name="username"]').val(); var city = $('#city-picker3').val(); var address = obj.find('[name="address"]').val(); var mobile = obj.find('[name="mobile"]').val(); var email = obj.find('[name="email"]').length ? obj.find('[name="email"]').val() : ''; if (person.length < 1){ console.log(person); msg = obj.find('[name="person"]').attr('placeholder')?obj.find('[name="person"]').attr('placeholder'):'璇烽€夋嫨鍩烘湰淇℃伅'; obj.find('[name="person"]').parents('.addContactA-e').inputError({'err': '', 'tips': 3, tipsMore: true}); }else if (person.length && $.inArray(person, ['鍖荤枟涓撲笟浜哄+','鎮h€?,'鎶曡祫鑰?,'姹傝亴鑰?,'濯掍綋','鍏朵粬']) === -1){ msg = obj.find('[name="person"]').attr('placeholder')?obj.find('[name="person"]').attr('placeholder'):'璇烽€夋嫨鍩烘湰淇℃伅'; obj.find('[name="person"]').parents('.addContactA-e').inputError({'err': '', 'tips': 3, tipsMore: true}); }else if (person == '鎮h€? && (usestr.length < 1 || $.inArray(usestr, ['宸蹭娇鐢ㄨ繃','鏈娇鐢ㄨ繃']) === -1)){ msg = obj.find('[name="use"]').attr('placeholder')?obj.find('[name="use"]').attr('placeholder'):'璇烽€夋嫨鏄惁浣跨敤杩?; obj.find('#personBBox').inputError({'err': '', 'tips': 3, tipsMore: true}); }else if (person == '鍏朵粬' && person_other.length < 1){ msg = obj.find('[name="person_other"]').attr('placeholder')?obj.find('[name="person_other"]').attr('placeholder'):'璇疯緭鍏ュ熀鏈俊鎭?; obj.find('[name="person_other"]').inputError({'err': '', 'tips': 3, tipsMore: true}); }else{ console.log(person); console.log(usestr); } if (area.length < 1){ msg = obj.find('[name="area"]').attr('placeholder')?obj.find('[name="area"]').attr('placeholder'):'璇烽€夋嫨鎮ㄥ叧娉ㄧ殑涓氬姟棰嗗煙'; obj.find('[name="area"]').parents('.testB-a').inputError({'err': '', 'tips': 3, tipsMore: true}); } if (wenti.length < 1){ msg = obj.find('[name="wenti"]').attr('placeholder')?obj.find('[name="wenti"]').attr('placeholder'):'璇烽€夋嫨鎮ㄧ殑闂绫诲瀷'; obj.find('[name="wenti"]').parents('.testB-a').inputError({'err': '', 'tips': 3, tipsMore: true}); } if (ask.length < 1){ msg = obj.find('[name="ask"]').attr('placeholder')?obj.find('[name="ask"]').attr('placeholder'):'璇疯緭鍏ユ偍鐨勫叿浣撻棶棰?; obj.find('[name="ask"]').parent().inputError({'err': '', 'tips': 3, tipsMore: true}); } if (username.length < 1 || username.length > 100){ msg = obj.find('[name="username"]').attr('placeholder')?obj.find('[name="username"]').attr('placeholder'):'璇疯緭鍏ュ鍚?; obj.find('[name="username"]').parent().inputError({'err': '', 'tips': 3, tipsMore: true}); } if (email.length < 1 || !CheckEmail(email)){ msg = obj.find('[name="email"]').attr('placeholder')?obj.find('[name="email"]').attr('placeholder'):'璇疯緭鍏ユ纭殑閭'; obj.find('[name="email"]').parent().inputError({'err': '', 'tips': 3, tipsMore: true}); } /*if (mobile.length <= 0){ msg = obj.find('[name="mobile"]').attr('placeholder')?obj.find('[name="mobile"]').attr('placeholder'):'璇疯緭鍏ユ墜鏈?; obj.find('[name="mobile"]').inputError({'err': '', 'tips': 3, tipsMore: true}); }else if (!CheckMobile(mobile)){ msg = obj.find('[name="mobile"]').attr('placeholder')?obj.find('[name="mobile"]').attr('placeholder'):'璇疯緭鍏ユ纭殑鎵嬫満'; obj.find('[name="mobile"]').inputError({'err': '', 'tips': 3, tipsMore: true}); }*/ if (msg.length){ obj.find('[type="submit"]').attr('disabled',false); return false; }else{ $.ajax({ type: 'POST', url: '/ajax', dataType: 'json', cache: false, data: {person:person, usestr:usestr, person_other:person_other, area:area, wenti:wenti, ask:ask, username:username, city:city, address:address, mobile:mobile, email:email, location:location.href, act:obj.find('[name="act"]').val(), formhash:obj.find('[name="formhash"]').val()}, error: function(){ alert('鍑洪敊浜嗭紒'); return false; }, success:function(json){ $('[name="formhash"]').val(json.formhash); if (json.errmsg == ''){ layer.alert(json.msg, {icon: 1}); o.reset(); }else{ layer.alert(json.errmsg, {icon: 2}); } obj.find('[type="submit"]').attr('disabled',false); } }); } return false; } function news2_search(o) { var obj = $(o); obj.find('[type="submit"]').attr('disabled',true); var msg = ''; layer.closeAll('tips'); var aid = obj.find('[name="aid"]').val(); var bid = obj.find('[name="bid"]').val(); var serKey = obj.find('[name="serKey"]').val(); if (aid || serKey){ }else{ $.get(window.location.href, {}, function (data, textStatus, jqXHR) { $('#news_list').html($(data).find('#news_list').html()); }, "html" ); return false; } if (msg.length){ obj.find('[type="submit"]').attr('disabled',false); return false; }else{ $.ajax({ type: 'POST', url: '/ajax', dataType: 'json', cache: false, data: {aid:aid, bid:bid, serKey:serKey, location:location.href, act:obj.find('[name="act"]').val(), formhash:obj.find('[name="formhash"]').val()}, error: function(){ alert('鍑洪敊浜?'); return false; }, success:function(json){ $('[name="formhash"]').val(json.formhash); if (json.errmsg == ''){ $('#news_list').html(json.msg); }else{ layer.alert(json.errmsg, {icon: 2}); } obj.find('[type="submit"]').attr('disabled',false); } }); } return false; } function news_search(o) { var obj = $(o); obj.find('[type="submit"]').attr('disabled',true); var msg = ''; layer.closeAll('tips'); var aid = obj.find('[name="aid"]').val(); var bid = obj.find('[name="bid"]').val(); var serKey = obj.find('[name="serKey"]').val(); if (aid || bid || serKey){ }else{ $.get(window.location.href, {}, function (data, textStatus, jqXHR) { $('#news_list').html($(data).find('#news_list').html()); }, "html" ); return false; } if (msg.length){ obj.find('[type="submit"]').attr('disabled',false); return false; }else{ $.ajax({ type: 'POST', url: '/ajax', dataType: 'json', cache: false, data: {aid:aid, bid:bid, serKey:serKey, location:location.href, act:obj.find('[name="act"]').val(), formhash:obj.find('[name="formhash"]').val()}, error: function(){ alert('鍑洪敊浜?'); return false; }, success:function(json){ $('[name="formhash"]').val(json.formhash); if (json.errmsg == ''){ $('#news_list').html(json.msg); }else{ layer.alert(json.errmsg, {icon: 2}); } obj.find('[type="submit"]').attr('disabled',false); } }); } return false; } function CheckMobile(m){ var reg = /^(((1[0-9]{2}))+\d{8})$/; if (reg.test(m)) { return true; } return false; } function CheckEmail(m){ var reg = /^([a-zA-Z0-9+_]|\-|\.)+@(([a-zA-Z0-9_]|\-)+\.)+[a-zA-Z]{2,6}$/; if (reg.test(m)) { return true; } return false; } jQuery.fn.extend({ inputError: function(options) { return this.each(function() { new jQuery.inputError(this, options); }); } }); jQuery.inputError = function(inputobj, options) { var opt = options || {}; opt.class = opt.class || 'inputerror'; opt.err = opt.err || ''; opt.tips = opt.tips || 2; opt.tipsMore = opt.tipsMore || false; var obj = $(inputobj); if (!obj.data('placeholder')){ obj.data('data-placeholder', obj.attr('placeholder')); obj.attr('placeholder', opt.err?opt.err:obj.data('placeholder')); } obj.removeClass(opt.class).addClass(opt.class); //灏弔ips if (opt.err) layer.tips(opt.err, obj, {tips: [opt.tips, '#dd1721'], tipsMore: opt.tipsMore}); obj.unbind('focus').focus(function(event) { $(this).removeClass(opt.class); //obj.attr('placeholder', obj.data('placeholder')); }); obj.unbind('blur').blur(function(event) { $(this).removeClass(opt.class); obj.attr('placeholder', obj.data('placeholder')); }); if (obj.get(0).tagName!='INPUT' && obj.get(0).tagName!='TEXTAREA' && !obj.data('bindClick')){ obj.click(function(event) { $(this).removeClass(opt.class); obj.attr('placeholder', obj.data('placeholder')); }); obj.children().click(function(){obj.click()}); obj.data('bindClick',true); } };