入您的留言'); $(".content_b").focus(); return false;} //if ($(".messagecode_b").val() == "") { alert("请输入验证码"); $(".messagecode_b").focus();return false; } }); //$('.messagecode_b').focus(function(){ // if($.trim($(".yzmbq").html()).length == 0){ // $('.yzmbq').append(''); // } // }); }); //选项卡 $(function(){ $('.navlf1 dl dd').hover(function(){ var i = $(this).index(); $(this).addClass('cur').siblings().removeClass('cur'); $('.navrtnr1').eq(i).addClass('active').siblings().removeClass('active'); }); $('.navlf4 dl dd').hover(function(){ var i = $(this).index(); $(this).addClass('cur').siblings().removeClass('cur'); $('.navrtnr4').eq(i).addClass('active').siblings().removeClass('active'); }); $('.navlf5 dl dd').hover(function(){ var i = $(this).index(); $(this).addClass('cur').siblings().removeClass('cur'); $('.navrtnr5').eq(i).addClass('active').siblings().removeClass('active'); }); $('.navlf6 dl dd').hover(function(){ var i = $(this).index(); $(this).addClass('cur').siblings().removeClass('cur'); $('.navrtnr6').eq(i).addClass('active').siblings().removeClass('active'); }); }); $(document).ready(function() { $('.navrt .navrtnr1:first').addClass('active'); $('.navrt .navrtnr4:first').addClass('active'); $('.navrt .navrtnr5:first').addClass('active'); $('.navrt .navrtnr6:first').addClass('active'); }); // 在页面加载完成后执行 document.addEventListener('DOMContentLoaded', function() { // 查找所有导航项 document.querySelectorAll('.dropdown').forEach(function(dropdown) { // 检查 dl 是否为空 var dl = dropdown.querySelector('.navlf dl'); var dropdownMenu = dropdown.querySelector('.dropdown_menu'); // 如果 dl 为空或没有子元素 if (!dl || dl.children.length === 0) { if (dropdownMenu) { dropdownMenu.style.height = '0'; dropdownMenu.style.overflow = 'hidden'; dropdownMenu.style.visibility = 'hidden'; dropdownMenu.style.opacity = '0'; } } }); }); $(".search-btn").on('click', function () { $(".search-alert").stop().fadeIn(300); $("body,html").addClass('ovh'); }); $(".search-alert .close").on('click', function () { $(".search-alert").stop().hide(); $("body,html").removeClass('ovh'); });