$(".banner .ranbtn1").hover(function(){ $(this).css("right",'90px'); },function(){ $(this).css("right",'-20px'); }); $(".banner .ranbtn2").hover(function(){ $(this).css("right",'90px'); },function(){ $(this).css("right",'-20px'); }); $("nav li").hover(function(){ $(this).find(".submenu").show(); },function(){ $(this).find(".submenu").hide(); }); $("nav li").click(function(){ $(this).addClass('active').siblings().removeClass("active"); $(this).find(".submenu").show(); $(this).siblings().find(".submenu").hide(); }); $("nav li").click(function(){ $(this).addClass('active').siblings().removeClass("active"); $(this).find(".submenu").show(); $(this).siblings().find(".submenu").hide(); }); $(".navbar-header").click(function(){ if($("nav").is(":hidden")){ $("nav").show(); $(this).find('i').html(''); $("html").css({ height: "100%", overflow: "hidden" }); $("body").css({ height: "100%", overflow: "hidden" }); }else{ $("nav").hide(); $(this).find('i').html(''); $("html").css({ height: "100%", overflow: "visible" }); $("body").css({ height: "100%", overflow: "visible" }); } }); var mobile_flag = isMobile(); if(!mobile_flag){ var agent = navigator.userAgent; if (/.*Firefox.*/.test(agent)) { document.addEventListener("DOMMouseScroll", function(e) { e = e || window.event; var detail = e.detail; if (detail > 0) { $(".page_header").css('display','none'); $(".page_header").css("position","relative"); $("nav").css('display','none'); $("nav").css("position","relative"); $("nav").css("top",""); $("nav").css("z-index",""); console.log("鼠标向下滚动"); } else { $(".page_header").css('display','block'); $(".page_header").css("position","fixed"); $(".page_header").css("top","0"); $(".page_header").css("z-index","9999"); $("nav").css('display','block'); $("nav").css("position","fixed"); $("nav").css("top","120px"); $("nav").css("z-index","9999"); $(".banner").css("margin-top","170px"); $(".listbanner").css("margin-top","170px"); console.warn("鼠标向上滚动"); } }); } else { document.onmousewheel = function(e) { e = e || window.event; var wheelDelta = e.wheelDelta; if (wheelDelta > 0) { $(".page_header").css('display','block'); $(".page_header").css("position","fixed"); $(".page_header").css("top","0"); $(".page_header").css("z-index","9999"); $("nav").css('display','block'); $("nav").css("position","fixed"); $("nav").css("top","120px"); $("nav").css("z-index","9999"); $(".banner").css("margin-top","170px"); $(".listbanner").css("margin-top","170px"); console.log("鼠标向上滚动"); } else { $(".page_header").css('display','none'); $(".page_header").css("position","relative"); $("nav").css('display','none'); $("nav").css("position","relative"); $("nav").css("top",""); $("nav").css("z-index",""); console.warn("鼠标向下滚动"); } } } } function isMobile() { var userAgentInfo = navigator.userAgent; var mobileAgents = [ "Android", "iPhone", "SymbianOS", "Windows Phone", "iPad","iPod"]; var mobile_flag = false; //根据userAgent判断是否是手机 for (var v = 0; v < mobileAgents.length; v++) { if (userAgentInfo.indexOf(mobileAgents[v]) > 0) { mobile_flag = true; break; } } var screen_width = window.screen.width; var screen_height = window.screen.height; //根据屏幕分辨率判断是否是手机 if(screen_width < 500 && screen_height < 800){ mobile_flag = true; } return mobile_flag; } $(".jrfzbtn").click(function(){ var id=$(this).data('id'); $(this).addClass('active').siblings().removeClass("active"); $('#jrfz'+id).show().siblings().hide(); }); layui.use(['element','carousel','layer'], function(){ var carousel = layui.carousel ,element = layui.element ,layer = layui.layer; //建造实例 carousel.render({ elem: '#banner' ,width: '100%' ,height: '600px' ,arrow: 'none' ,autoplay: true }); //建造实例 carousel.render({ elem: '#banner_m' ,width: '100%' ,height: '257px' ,arrow: 'none' ,autoplay: true }); $(".videoplayer").click(function(){ $('.video').hide(); $('.index_video .desc').hide(); $('.video_play').show(); }); });