Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个向右浮动的 div 和 onClick,我想显示另一个 DIV,其中包含一个可以单击的项目列表,这些项目也可以通过 id 分配,它们自己的点击事件。例如下拉菜单。
我怎么能做到这一点?
如果我理解正确,您想在单击另一个 div 时显示一个 div?
$("#diva").on("click", function(){ $("#divb").toggle(); });
示例:http: //jsbin.com/uxaxap/edit#javascript,html
这看起来很有希望:http ://css-tricks.com/simple-jquery-dropdowns/
$("#diva ul li").click(function(){ $(this).find('#div').slideToggle(); });