$(function() { //超过一定高度导航添加类名 var nav = $("header"); //得到导航对象 var win = $(window); //得到窗口对象 var sc = $(document); //得到document文档对象。 win.scroll(function() { if (sc.scrolltop() >= 100) { nav.addclass("on"); } else { nav.removeclass("on"); } }) //移动端展开nav $('#navtoggle').on('click', function() { $('.m_nav').addclass('open'); }) //关闭nav $('.m_nav .top .closed').on('click', function() { $('.m_nav').removeclass('open'); }) //二级导航 移动端 $(".m_nav .ul li").click(function() { $(this).children("div.dropdown_menu").slidetoggle('slow') $(this).siblings('li').children('.dropdown_menu').slideup('slow'); }); // function closeerr(){ // $(".alertimgerr").hide(); // } // $("body").append("
"); // $(".closeerr").on('click', function(event) { // $(".alertimgerr").hide(); // }); // if($(".z-system-rongyu>.swiper-container>.swiper-wrapper>.swiper-slide>img").length > 0){ // $(".z-system-rongyu>.swiper-container>.swiper-wrapper>.swiper-slide>img").each(function() { // var $img = $(this); // $img[0].onload = function (){ // var hei = $img.height(); // var wid = $img.width(); // if(hei > wid){ // $img.css({ // 'height': '100%', // 'width': 'auto', // }); // }else{ // $img.parent().css({ // 'width': '300px', // }); // $img.css({ // 'position': 'absolute', // 'top': '50%', // 'left': '50%', // 'transform': 'translate(-50%,-50%)', // }); // } // } // }); // } })