jQuery容易下拉菜单? [英] jQuery easy pulldown menu?

查看:89
本文介绍了jQuery容易下拉菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个简单的下拉菜单。

代码和演示在这里:

解决方案

删除 return false; ,我相信这是你的问题。 http://jsfiddle.net/3Lq2d/3/

另外,我建议你使用一个无序列表来代替divs,这样做更有意义,它会减少头痛。



看看我刚才写的这篇教程 http://www.onextrapixel.com/2011/06/03/how-to-create-a-horizo​​ntal-dropdown-menu-with-html-css-and-jquery /


I've built a simple dropdown menu.
The code and demo is here: http://jsfiddle.net/3Lq2d/5/
It looks like this:

Mousing over MENU 1 fades in the Submenus.

It works great, unless you happen to be a spaz and jiggle your mouse around a lot over the menu, in which case it gets stuck in a semi-transparent state.

Using .stop(true,true) fixes the spaz issue, but removes the ability to mouse down from the menu to the submenu. I am using fadeIn/fadeOut to give a slight delay, so when the mouse moves from the menu to the submenu, the submenu stays visible ... stop(true,true) breaks this.

What's the best way to build a fading menu with a slight delay in all the right places?


UPDATE:

I tinkered until total satisfaction, adding delays for hoverintent ... here's the final code: http://jsfiddle.net/3Lq2d/75/

解决方案

Remove both return false;, I believe this is your problem. http://jsfiddle.net/3Lq2d/3/

Also, I suggest you use an unordered list for this instead of divs, it makes more sense and it'll give you less headaches.

Take a look at this tutorial I wrote a while ago http://www.onextrapixel.com/2011/06/03/how-to-create-a-horizontal-dropdown-menu-with-html-css-and-jquery/

这篇关于jQuery容易下拉菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆