CSS3 下拉菜单假JS问题
CSS3 Drop-down menu fake JS issues
我正在尝试使用 Jquery 和 [=37= 风格化 dropdown 菜单]。
我做了这份工作,这正是我想要的。
唯一的问题是 Jquery.
是个把戏
我想 hide/show 一个 div 当我点击我的菜单按钮之一。
问题是它没有完成这项工作。
但它没有诀窍。
这里的代码有效:
https://jsfiddle.net/74ca3epv/2/
你可以看到这是有效的,但是
remove the display:none
from the .styledSelect
你看到 show/hide div 不再工作了。
我希望你能明白我的意思。
欢迎所有评论:) 谢谢!
您必须在此处进行更改:
$listItems.click(function (e) {
e.stopPropagation();
$styledSelect.text($(this).text()).removeClass('active');
$this.val($(this).attr('rel'));
$list.hide();
//alert($(this).attr('rel'));
if($(this).attr("rel")=="reservation1"){
$("#information").hide();
$("#reservation").show();
}
if($(this).attr("rel")=="information1"){
$("#reservation").hide();
$("#information").show();
}
if($(this).attr("rel")=="choose1"){
$("#reservation").hide();
$("#information").hide();
}
/* alert($this.val()); Uncomment this for demonstration! */
});
我正在尝试使用 Jquery 和 [=37= 风格化 dropdown 菜单]。 我做了这份工作,这正是我想要的。 唯一的问题是 Jquery.
是个把戏我想 hide/show 一个 div 当我点击我的菜单按钮之一。 问题是它没有完成这项工作。 但它没有诀窍。
这里的代码有效:
https://jsfiddle.net/74ca3epv/2/
你可以看到这是有效的,但是
remove the
display:none
from the.styledSelect
你看到 show/hide div 不再工作了。 我希望你能明白我的意思。 欢迎所有评论:) 谢谢!
您必须在此处进行更改:
$listItems.click(function (e) {
e.stopPropagation();
$styledSelect.text($(this).text()).removeClass('active');
$this.val($(this).attr('rel'));
$list.hide();
//alert($(this).attr('rel'));
if($(this).attr("rel")=="reservation1"){
$("#information").hide();
$("#reservation").show();
}
if($(this).attr("rel")=="information1"){
$("#reservation").hide();
$("#information").show();
}
if($(this).attr("rel")=="choose1"){
$("#reservation").hide();
$("#information").hide();
}
/* alert($this.val()); Uncomment this for demonstration! */
});