我有一个响应式固定顶部菜单,在单击“菜单”图标后打开。 然后我想隐藏它点击其中一个菜单项。否则它会覆盖滑动部分的部分。
jQuery(function( $ ){
$("header .genesis-nav-menu, .nav-primary .genesis-nav-menu").addClass("responsive-menu").before('<div class="responsive-menu-icon"></div>');
$(".responsive-menu-icon").click(function(){
$(this).next("header .genesis-nav-menu, .nav-primary .genesis-nav-menu").slideToggle();
});
$(window).resize(function(){
if(window.innerWidth > 600) {
$("header .genesis-nav-menu, .nav-primary .genesis-nav-menu, nav .sub-menu").removeAttr("style");
$(".responsive-menu > .menu-item").removeClass("menu-open");
}
});
$(".responsive-menu > .menu-item").click(function(event){
if (event.target !== this)
return;
$(this).find(".sub-menu:first").slideToggle(function() {
$(this).parent().toggleClass("menu-open");
});
});
});
答案 0 :(得分:2)
$('#whatever_you_click').change(function() {
$('#whatever_you_want_to_hide').hide();
});
答案 1 :(得分:2)
如果没有相关的HTML或知道您使用的是哪个菜单插件,最好只能猜测。
例如,您可能需要slideToggle和removeClass - 它不清楚removeClass是否足够
declare @test table (QuestionKey nvarchar(100), ResponseValue nvarchar(100))
insert into @test (QuestionKey, ResponseValue)
values
('Cust_3_3_a', ''), ('Cust_3_4_', '-'),
('Cust_3_3_b', ''),
('Cust_3_3_c', ''),
('Cust_3_3_e', 'a'),
('Cust_3_3_f', ''),
('Cust_3_3_g', ''),
('Cust_3_3_h', '')
select
max(case
when (
(t.questionkey = 'Cust_3_3_e' AND nullif(t.ResponseValue, '') IS NOT NULL)
and (t.questionkey = 'Cust_3_4_' AND nullif(t.ResponseValue, '') != '-')
) then 1
when (
(t.questionkey = 'Cust_3_3_e' AND nullif(t.ResponseValue, '') IS NOT NULL)
and (t.questionkey = 'Cust_3_4_' AND nullif(t.ResponseValue, '') = '-')
) then 0
when (
t.questionkey BETWEEN 'Cust_3_3_a' AND 'Cust_3_3_c'
OR t.questionkey BETWEEN 'Cust_3_3_f' AND 'Cust_3_3_h'
OR t.questionkey = 'Cust_3_4_'
) and nullif(t.ResponseValue, '') IS NOT NULL then 1
else 0
end) as test1
from @test t
您可能想要类似.sub-menu点击