$(function () { //手机导航 $("#menu_h").click(function(){ $("body").toggleClass("menu-open").removeClass("search-open"); }) //手机导航展开 $(".menu li .ii").click(function(){ $(this).parents("li").toggleClass("open").siblings().removeClass("open"); }) //手机端搜索展开 $("#search-bon").click(function(){ $("body").toggleClass("search-open").removeClass("menu-open").removeClass("lang-open") var ps=$(".header .search input") if($("body").hasClass("search-open")){ ps.focus(); }else{ ps.blur(); } }); //手机端语言展开 $("#languase-open").click(function(){ $("body").toggleClass("lang-open").removeClass("menu-open").removeClass("search-open"); }) //导航遮罩 $(".ph-mask-bg").on("touchmove",function(e){ e.preventDefault(); }); $(".ph-mask-bg").on("click",function(e){ $("body").removeClass("menu-open").removeClass("lang-open").removeClass("search-open"); }); //选项卡切换 $(".tab-a").on("mouseenter",function(){ $(this).addClass("cur").siblings().removeClass("cur"); var i=$(this).index(); $(this).parents(".tab-box").find(".tab-b").eq(i).show().siblings().hide(); }); setTimeout(function(){ $(".tab-box").each(function(){ $(this).find(".tab-a").eq(0).mouseenter(); }) },600) //视频播放器 layui.use('layer', function(){ var layer = layui.layer; var pcarea=['1000px', '600px']; if($(window).width()<=1660) pcarea=['800px', '480px']; if($(window).width()<=750) pcarea=['90%', '60%']; $(".play").click(function(){ var src=$(this).attr("data-src") layer.open({ type: 1, title:false, skin: 'layui-layer-video', //加上边框 area: pcarea, //宽高 content: '' }); $("#indVideo")[0].play() }) }); //导航滚动跟随 $(window).scroll(function(){ var t=$(window).scrollTop(); if(t>$(".header .top").height()){ $("body").addClass("bodyfixd"); }else{ $("body").removeClass("bodyfixd"); } }) //入场动画 wow = new WOW( { animateClass: 'animated', offset:50 } ); wow.init(); }) //搜索跳转 function search(){ var $th=$(event.currentTarget).parents(".search"), val=$th.find(".ss").val(); if(val==""){ layer.msg("请输入关键字") return false; } var root="/" window.location.href=root+"other/search_news.htmp?key="+val; } //载入错误图片 var nullimg = '../images/error_03.jpg';//错误图路径; function lod(t) { t.onerror = null; t.src = nullimg } //end //图片比例回调 function imgratio() { var winw=$(window).width(); $("img[data-ratio]").each(function (index, element) { var $this = $(this); var rat=Number($this.attr("data-ratio")); if(!rat || rat=="") rat=1; $this.css({ height: Math.floor($this.width() * $this.data("ratio")) }) }); } //响应式字号缩放 function getsize() { var w = $(window).width(); if(w < 414) { var s = (w / 414 * 0.625) * 100 + "%" $("html").css("font-size", s); } } $(function() { //手机版字号缩放 $(window).resize(function(e) { getsize(); imgratio() }) getsize(); // imgratio() }) //end