$(function(){ //pc下拉 var $i; var $flag = false; $(".sub").hover(function(){ $flag = true; },function(){ $(".sub[data-m='"+$i+"']").slideup(); $(".menu .nli a[data-n='"+$i+"']").parent().parent().removeclass("active"); $flag = false; }); $(".menu .nli span a").hoverintent(function(){ $i = $(this).attr("data-n"); $(".sub[data-m='"+$i+"']").slidedown(); $(this).parent().parent().addclass("active"); },function(){ if(!$flag){ $(".sub[data-m='"+$i+"']").slideup(); $(this).parent().parent().removeclass("active"); } }); // 滚动头部动画 $(window).scroll(function() { if ($(window).scrolltop() > 0) { $(".top1,.top2,.pz_banner").addclass("active"); } else { $(".top1,.top2,.pz_banner").removeclass("active"); } }); //pc搜索 $("#topsearch").hover(function () { $(this).addclass("active"); $(this).find(".searchinput").focus(); },function () { $(this).removeclass("active"); $(this).find(".searchinput").blur(); $(this).find(".searchinput").val("") }); //返回头部 $("#imgotop").on("click",function () { $("body,html").animate({ scrolltop:0 },500); }); // 图片预览弹窗 $(".showlightbox").lightbox(); //返回顶部 $(".divbox").on("click",function () { $("body,html").animate({ scrolltop:0 },500); }); // 菜单下拉 $("#menuph").click(function(){ $(this).find(".point").toggleclass("active"); $(".top2,.phonemeng").toggleclass('active'); $(".xialaph").slidetoggle(); $("body,html").animate({ scrolltop:0 },500); }); $(".xialaph .tp").click(function(){ $(this).siblings(".ul2").slidetoggle(); $(this).parent().siblings().find(".ul2,.ul3").slideup(); $(this).toggleclass("active"); $(this).parent().siblings().find(".tp,h5").removeclass('active'); }); $(".xialaph h4").click(function(){ $(this).siblings(".ul2").slidetoggle(); $(this).parent().siblings().find(".ul2,.ul3").slideup(); $(this).toggleclass("active"); $(this).parent().siblings().find("h4,h5").removeclass('active'); }); $(".xialaph h5").click(function(){ $(this).siblings(".ul3").slidetoggle(); $(this).parent().siblings().find(".ul3").slideup(); $(this).toggleclass("active"); $(this).parent().siblings().find("h4,h5").removeclass('active'); }); //底部 // $(".lian h5").click(function(){ // $(".lian .ul1").toggleclass('active'); // }); // $(".lian").bind('mouseleave', function () { // $(".lian .ul1").removeclass('active'); // }); //底部 if($(window).width()<992){ $(".footul .ttit").on("touchstart",function(){ $(this).toggleclass("active"); $(this).parent().siblings().find(".ttit").removeclass('active'); $(this).siblings("ul").slidetoggle(); $(this).parent().siblings().find("ul").slideup(); }); } //边导航 $("#mright").click(function(){ $(this).toggleclass("active"); $("#lay2").slidetoggle(); $("#lay2 h3").removeclass('active'); }); $("#lay2 h3").click(function(){ $(this).siblings(".l1ul").slidetoggle(); $(this).parent().parent().siblings().find(".l1ul").slideup(); $(this).toggleclass("active"); $(this).parent().parent().siblings().find("h3").removeclass('active'); }); $(".pz_sidelayer h4").click(function(){ $(this).parent().siblings().find(".ul2").slideup(); $(this).siblings(".ul2").slidetoggle(); $(this).parent().toggleclass("active"); }); function func1(){ //首页关于我们 new picfn({ k:1,//高宽比系数 odivcla:'.owl_ico li .icond',//图片外框 }); // 案例列表 new picfn({ k:0.7526315789473684,//高宽比系数 odivcla:'.casebox li .img',//图片外框 }); // 新闻列表 new picfn({ k:0.748,//高宽比系数 odivcla:'.ul_2 li .img',//图片外框 }); // 应用领域 new picfn({ k:0.75,//高宽比系数 odivcla:'.useapplist li .appbox',//图片外框 }); // 产品列表 new picfn({ k:0.7513227513227513,//高宽比系数 odivcla:'.productlist li .light',//图片外框 }); } function func2(){ } function addloadevent(func){ var oldonload=window.onload; if(typeof window.onload!="function"){ window.onload=func; }else{ window.onload=function(){ oldonload(); func(); } } } addloadevent(func1); addloadevent(func2); $(window).resize(function () { var timer=settimeout(function(){ func1(); func2(); },100) }); function picfn(option){ var k=option.k;//高宽比系数 var odiv=$(option.odivcla);//图片外框 imgfn(); function imgfn(){ odiv.each(function(){ var iwid=$(this).width(); $(this).height(k*iwid); var ihei=$(this).height(); }) } } });