[英]jQuery: onclick drop-down menu with controls
I wish to create a menu (a sign-up menu), see this to get an idea of it. 我希望创建一个菜单(注册菜单),请看一下以了解它。 When user clicks on this button/link a drop-down menu appears, using which he can do something (here login).
当用户单击此按钮/链接时,将出现一个下拉菜单,他可以使用该菜单执行某些操作(在此登录)。
The behaviour of the link should be the following: 链接的行为应为以下情况:
I did somehow managed to get first three working, but then the controls within the drop-down menu (4th behaviour) are not working. 我确实设法使前三个工作正常,但是随后下拉菜单(第4个行为)中的控件却无法工作。
The javascript/jQuery code along with html code is given here (jsfiddle link, same as above). 此处提供了javascript / jQuery代码以及html代码(jsfiddle链接,与上面相同)。 You can fork it and make changes.
您可以分叉并进行更改。
Thanks. 谢谢。
check this 检查这个
http://thefinishedbox.com/files/freebies/loginfreebie/index.html http://thefinishedbox.com/files/freebies/loginfreebie/index.html
Download tha code 下载代码
http://thefinishedbox.com/freebies/scripts/jquery-dropdown-login/ http://thefinishedbox.com/freebies/scripts/jquery-dropdown-login/
I made a fork of what you have on your jsFiddle: http://jsfiddle.net/DukyJ/ 我对您在jsFiddle上的功能进行了分叉: http : //jsfiddle.net/DukyJ/
If you look at the code I just added an extra div to have the page's content so I don't have to assign click events to the whole body just only to that div. 如果您看一下代码,我只是添加了一个额外的div来获取页面的内容,因此我不必仅将点击事件分配给整个div。 Then, I removed the return false and the stopProppagation and just added a '#' to the link in the href because it wasn't necesary.
然后,我删除了return false和stopProppagation,并在href中的链接中添加了一个“#”,因为它不是必需的。 And finally just added some style to the signin link and the singin panel so you can see that the menu appears over the content as I suppose you want it to appear.
最后,仅在登录链接和singin面板中添加了一些样式,因此您可以看到菜单出现在内容上方,就像我想您希望它出现一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.