let html = []; $(".navigation>ul>li").hover(function() { $(this).addClass("on").siblings().removeClass("on") // clearTouch("body", "hidden") }, function() {}) // $("li.navigation-product").hover(function() { getCatesPoter(".navigation-product", 1) if ($(this).find(".navfix").length > 0) { $(".navfix-bg").addClass("navfix-bg-active") } $(this).find(".navfix-center").removeClass('navfix-center-active'); $(this).find(".navfix-right").removeClass('navfix-right-active'); $(this).children(".navfix").stop().slideDown() $(this).siblings().children(".navfix").stop().slideUp(); // clearTouch("body", "hidden") }, function() { $(".navfix-bg").removeClass("navfix-bg-active") $(this).children(".navfix").stop().slideUp() // clearTouch("body", "auto"); }) // $("li.navigation-product .navfix-cates li.navfix-product-id").hover(function(e) { e.stopPropagation(); let ids = $(this).find('h3').attr("data-id"); getCatesSubnav(ids); getCatesPoter(".navigation-product", ids); }, function() { }) // $("li.navigation-product .navfix-cates li.navfix-solution-id").hover(function(e) { e.stopPropagation(); let ids = $(this).find('h3').attr("data-id"); $(this).find(".navfix-right").removeClass('navfix-right-active'); $(this).find(".navfix-center").removeClass('navfix-center-active'); getCatesPoter(".navigation-product", ids) }, function() { }) // $("li.navigation-solution").hover(function(e) { getCatesPoter($(this), 2) if ($(this).find(".navfix").length > 0) { $(".navfix-bg").addClass("navfix-bg-active") } $(this).addClass("on").siblings().removeClass("on") $(this).children(".navfix").stop().slideDown() $(this).siblings().children(".navfix").stop().slideUp(); // clearTouch("body", "hidden") }, function() { $(".navfix-bg").removeClass("navfix-bg-active") $(this).children(".navfix").stop().slideUp() // clearTouch("body", "auto"); }) // $("li.navigation-solution .navfix-cates li.navfix-solution-id").hover(function(e) { e.stopPropagation(); let ids = $(this).find('h3').attr("data-id"); $(this).find(".navfix-right").removeClass('navfix-right-active'); getCatesPoter("li.navigation-solution", ids) }, function() { }) // 获二级菜单 function getCatesSubnav(param) { // console.log(param) if (!param) { return false; } let url = '/api.php/cms/nav/scode/' + param $.ajax({ type: 'POST', url: url, dataType: 'json', data: siteKeys, success: function(response, status) { html = []; if (response.code) { response = response.data // 判断子菜单 if (response.length > 0) { $(".navigation-product").find(".navfix-center .navfix-menus").html(''); $(".navigation-product").find(".navfix-center").addClass('navfix-center-active'); $(".navigation-product").find(".navfix-right").addClass('navfix-right-active'); html += "
"; for (let i = 0; i < response.length; i++) { html += '

' + response[i].name + '

'; } html += "
"; $(".navigation-product").find(".navfix-center .navfix-menus").append(html); } else { $(".navigation-product").find(".navfix-center").removeClass('navfix-center-active'); $(".navigation-product").find(".navfix-right").removeClass('navfix-right-active'); } } else { console.log("返回错误数据"); } } }); } // 获取产品 $(".navfix-center").on("mouseenter", "dd", function() { html = []; let ids = $(this).attr("data-id"); let url = '/api.php/list/' + ids; $.ajax({ type: 'POST', url: url, dataType: 'json', data: siteKeys, success: function(response, status) { // console.log(response) if (response.code) { $(".navfix-right").html(''); response = response.data html += ''; $(".navigation-product").find(".navfix-right").append(html); } else { console.log("返回错误数据"); } } }); }) // function getCatesPoter(seletor, param) { if (!param) { return false; } let url = '/api.php/cms/sort/scode/' + param $.ajax({ type: 'POST', url: url, dataType: 'json', data: siteKeys, success: function(response, status) { $(seletor).find(".navfix-right").html(''); if (response.code) { response = response.data html = ''; $(seletor).find(".navfix-right").append(html); html = []; } else { console.log("返回错误数据"); } } }); } // 移动端 function clearTouch(el, oStyle) { $(el).css('overflow', oStyle); $(el).on("touchmove", function(e) { e.preventDefault; }) } $('.navbar').click(function() { $('.burger-bg').removeClass('burger-bg-active'); clearTouch("body", "hidden") }) $('.close-burger').click(function() { $('.burger-bg').addClass('burger-bg-active'); clearTouch("body", "auto") }) $('.burger-nav-lists>li').click(function(e) { if ($(this).find('.burger-nav-f1').length > 0) { if ($(this).find('.burger-nav-f1').css('display') == 'none') { // 菜单展开 $(this).find(".burger-nav-f1").slideDown(200); // 其他菜单收起 } else { $(this).find(".burger-nav-f1").slideUp(200); $(this).find(".burger-nav-f1").slideUp(200) $(this).find(".burger-nav-f2").slideUp(200) } } else {} }) $('.burger-nav-f1>li').click(function(e) { e.stopPropagation(); if ($(this).find('.burger-nav-f2').length > 0) { if ($(this).find('.burger-nav-f2').css('display') == 'none') { $(this).find(".burger-nav-f2").slideDown(200); } else { $(this).find(".burger-nav-f2").slideUp(200); } } else { } })