//延迟动画 $(function(){ var wow = new wow({ boxclass: 'wow', animateclass: 'animated', offset: 0, mobile: false, live: true }) wow.init(); }); function stopbubble(e) { // 如果传入了事件对象,那么就是非ie浏览器 if (e && e.stoppropagation) { //因此它支持w3c的stoppropagation()方法 e.stoppropagation(); } else { //否则我们使用ie的方法来取消事件冒泡 window.event.cancelbubble = true; } } //实现滚动条无法滚动 var mo=function(e){e.preventdefault();}; /***禁止滑动***/ function stop(){ document.body.style.overflow='hidden'; document.addeventlistener("touchmove",mo,false);//禁止页面滑动 } /***取消滑动限制***/ function move(){ document.body.style.overflow='';//出现滚动条 document.removeeventlistener("touchmove",mo,false); } //点击事件定义 var tap; var clickactive = function(){ //// 判断设备是否具有touch事件 var g; var t = "ontouchstart" in document ? true : false; ////alert(t) if(t){ g = 'tap'; }else{ g = 'click'; } tap = g; return tap; }() $("").on("touchstart",function(e){ }) $("").on('click', function(){ }) //顶部pc导航功能 $(".pc-nav .lv1-box").hover(function(){ $(this).find(".lv2-box").stop(true,true).slidedown(); },function(){ $(this).find(".lv2-box").stop(true,true).hide(); }) //返回顶部 $(window).scroll(function () { if ($(window).scrolltop() >100) { $(".back-top").fadein(); } else { $(".back-top").fadeout(0); } }); $(".back-top").on('click', function () { $('html,body').animate({ scrolltop: 0 }, 200); }); //手机端导航按钮功能 $(".nav-btn img").on('click', function () { $(".nav-pop").animate({left:"0"},500); }); $(".nav-pop .top .right img").on('click', function () { $(".nav-pop").animate({left:"-100%"},500); $(".nav-pop").find("em").removeclass("on"); $(".nav-pop").find(".lv2-box").hide(); $(".nav-pop .sou-pop").hide(); }); //手机端导航伸展 $(".lv1-box .dian").on('click', function(){ $(this).parent().siblings(".lv2-box").stop(true,true).slidetoggle(); $(this).toggleclass("on"); $(this).parent().parent().siblings().find(".dian").removeclass("on"); $(this).parent().parent().siblings().find(".lv2-box").stop(true,true).slideup(); }) //屏幕伸展时变化 $(window).resize(function(){ var width=$(document.body).width();//得到可视屏幕的宽度 if(width>=1200){ $(".nav-pop").find("em").removeclass("on"); $(".nav-pop").find(".lv2-box").hide(); $(".nav-pop").css("left","-100%") $(".nav-pop .sou-pop").hide(); $(".footer-box .ipad-nav").find("em").removeclass("on"); $(".footer-box .ipad-nav").find(".lv2-box").hide(); }else{ $(".header-box .top .pc-search").css("width","0"); } if(width>=768){ } }) //pc搜索框 $(".pc-sou1").on('click', function () { $(".header-box .top .pc-search").animate({width:"40%"},300); }); $(".pc-search .off").on('click', function () { $(".header-box .top .pc-search").animate({width:"0"},0); }); //动画效果添加 $(".common-box").addclass("fadeinup wow"); //弹出层功能 $(".pop-btn").on('click', function () { $(".pop-box").animate({left:"0"},500); stop(); }); $(".close-btn").on('click', function () { $(".pop-box").animate({left:"-100%"},500); move(); }); //地图高度自适应 //$(function(){ //function map_height(){ //var width1=$(".link-main .link-map").width(); //var height1=width1*0.381667; //$(".link-main .link-map").css("height",height1+"px"); //}; //map_height(); //$(window).resize(function(){ //map_height(); //}); //}); //详情页字体大小变化 $(".info3 .i1").on('click', function(){ $(".newsd-main .left .doc").addclass("on1") $(".newsd-main .left .doc").removeclass("on2 on3") }) $(".info3 .i2").on('click', function(){ $(".newsd-main .left .doc").addclass("on2") $(".newsd-main .left .doc").removeclass("on1 on3") }) $(".info3 .i3").on('click', function(){ $(".newsd-main .left .doc").addclass("on3") $(".newsd-main .left .doc").removeclass("on1 on2") }) //视频高度自适应1 $(function(){ function index_video(){ var videow=$(".newsd-main .video-box").width(); var videoh=videow*0.55825; $(".newsd-main .video-box").css("height",videoh+"px"); var videow1=$(".newsd-main .video-box2").width(); var videoh1=videow1*0.55825; $(".newsd-main .video-box2").css("height",videoh1+"px"); }; index_video(); $(window).resize(function(){ index_video(); }); }); //视频高度自适应2 $(function(){ function index_video1(){ var videow=$(".medias-main .video-box").width(); var videoh=videow*0.5625; $(".medias-main .video-box").css("height",videoh+"px"); var videow1=$(".medias-main .video-box2").width(); var videoh1=videow1*0.5625; $(".medias-main .video-box2").css("height",videoh1+"px"); }; index_video1(); $(window).resize(function(){ index_video1(); }); }); //视频高度自适应3 $(function(){ function index_video2(){ var videow=$(".pop-box1 .video-box").width(); var videoh=videow*0.5625; $(".pop-box1 .video-box").css("height",videoh+"px"); var videow1=$(".pop-box1 .video-box2").width(); var videoh1=videow1*0.5625; $(".pop-box1 .video-box2").css("height",videoh1+"px"); }; index_video2(); $(window).resize(function(){ index_video2(); }); }); //视频点击隐藏文字 $(".medias-main .top .left .video-box").on('click', function(){ $(".medias-main .top .left .name").hide() }) $(".medias-main .top .left .video-box2").on('click', function(){ $(".medias-main .top .left .name").hide() }) //视频弹出 //var videofunc = function(){ //var myplayer = videojs('index_video'); //myplayer.play(); //$(".pop-box1").animate({left:"0"},300); //stop(); //} //$(".pop-box1").on('click', function(){ //var myplayer = videojs('index_video'); //myplayer.load(); //$(".pop-box1").animate({left:"-100%"},0); //move(); //}) $(".pop-box1 .pop-main").on('click', function(e){ stopbubble(e) }) //手机端搜索框距离 $(function(){ function poptop(){ var toph=$(".nav-pop .top").height()+8; $(".nav-pop .sou-pop").css("top",toph+"px"); }; poptop(); $(window).resize(function(){ poptop(); }); }); //手机端搜索框出现和消失 var soufunc = function(){ $(".nav-pop .sou-pop").fadein(); } $(".nav-pop .sou-pop").on('click', function(){ $(this).fadeout(); }) $(".nav-pop .sou-pop .cont").on('click', function(e){ stopbubble(e) }) //轨道交通选项卡 var pt = $(".pt-box li"); pt.hover(function(){ $(this).addclass("on").siblings().removeclass("on"); var index = pt.index(this); $(".pts-box .item").eq(index).addclass("on").siblings().removeclass("on"); }) //信号系统选项卡 var pi = $(".pc-tab li"); pi.on('click', function(){ $(this).addclass("on").siblings().removeclass("on"); var index = pi.index(this); $(".pc-tabd .item").eq(index).addclass("on").siblings().removeclass("on"); }) //信号系统手机端选项卡 $(".ph-tab .name").on("touchstart",function(e){ $(this).siblings(".list").stop(true,true).slidetoggle(); $(this).toggleclass("on"); }) var pb = $(".ph-tab .list li"); $(".ph-tab .list li").on("touchstart",function(e){ var txt = $(this).text(); $(this).parent().stop(true,true).slideup(); $(".ph-tab .name").text(txt); $(".ph-tab .name").removeclass("on"); $(this).addclass("on").siblings().removeclass("on"); var index = pb.index(this); $(".pc-tabd .item").eq(index).addclass("on").siblings().removeclass("on"); }) $(document).on("touchstart",function(e){ $(".ph-tab .list").stop(true,true).slideup(); $(".ph-tab .name").removeclass("on"); }) $(".ph-tab .list li").on("touchstart",function(e){ stopbubble(e); }) $(".ph-tab .name").on("touchstart",function(e){ stopbubble(e); }) //滚动条置顶 var width=$(document.body).width();//得到可视屏幕的宽度 if(width>1200){ var nav = $(".second-nav"); //得到导航对象 var win = $(window); //得到窗口对象 var sc=$(document);//得到document文档对象。 win.scroll(function(){ if(sc.scrolltop()>=400){ nav.addclass("on"); nav.show(); }else if(sc.scrolltop()<=200){ nav.show(); nav.removeclass("on"); }else{ nav.removeclass("on"); nav.hide(); } }) }else{ }