- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
子菜单成功出现,但不会用mouseleave
隐藏功能。运行 console.log() 显示事件将在鼠标退出 <ul>
的正确时刻触发。 ,但由于某种原因它不会隐藏。但是,我可以更改其他样式(例如 <ul>
的背景为红色或其他。)非常令人费解...
$(document).ready(function() {
$(".topLine").hover(function() {
$(".subTopNav").hide(); //hide all potentially open submenus
$(this).find(".subTopNav").show(); //show this submenu
});
$(".subTopNav").mouseleave(function() { //if mouse leaves the submenu
$(this).hide(); //hide the open submenu (this is what isn't working)
$(this).css('background-color','red'); //this works
})
});
<li class="topLine">
<span class="topNavItem">Item 1</span>
<ul class="subTopNav">
<li><a href="#">subItem 1</a></li>
<li><a href="#">subItem 2</a></li>
<li><a href="#">subItem 3</a></li>
</ul>
</li>
#topNavItems { display: inline; line-height: 40px; }
#topNavItems li { display: inline; font-weight: bold; margin-right: 45px; cursor: pointer; }
#topNavItems li a { text-decoration: none; color: #000000; }
.topLine { position: relative; }
.subTopNav { display: none; position: absolute; top: 20px; left: 25%; background-color: #000000; width: 145px; color: #FFFFFF; padding-left: 10px; }
.subTopNav li { display: block; color: #CCCCCC; font-weight: normal !important; font-size: 12px; line-height: 24px; margin-right: 0px !important; }
.subTopNav a { color: #CCCCCC !important; display: block; }
.subTopNav a:hover { color: #FFFFFF !important; }
最佳答案
问题在于,hover()
仅与一个参数函数一起使用会触发 mouseenter
和 mouseleave
的相同函数
.hover( mouseenterHandler,mouseleaveHandler)
或
.hover( singleHandler/* triggers for both events*/)
将 hover
更改为 mouseenter
并且代码可以运行
API 引用:http://api.jquery.com/hover/
关于jquery - 为什么这个 jquery.hide() 函数不能作用于这个 UL 元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14034763/
我想要一个“父”节点,它生成数据并将其传递给工作节点,工作节点将对数据进行必要的计算。 我希望父节点坐下来“监听”工作节点何时告诉他他已准备好接收数据。 实现这一目标的最佳方法是什么?我应该为此使用哪
我想从 c# 写一些 Html(html 是一个例子,这可能是其他语言..) 例如: string div = @" Mon text
由于某种原因,在使用我放置在 XML 中的任何新 View 时,我收到了 nullPointerException。 View 类型(TextView、EditText 等)并不重要。我最初工作的任何
就像在 hibernate 中一样,在 EclipseLink 中,我们有注释 @AdditionalCriteria,它允许我们在数据上添加过滤器。在 hibernate 中,它作为@Filter,
file_get_contents() [function.file-get-contents]: SSL: Connection reset by peer in 上 file_get_conten
我有一个简单的 从某些 JS 中隐藏的标签。 ( display:none )我查看了页面源代码,发现它没有隐藏,但是检查器将其显示为显示:无(内联样式) 为了隔离隐藏 的代码部分,在 JS 代码中
我在 GUI 中工作,我有多种类型的事件可能会导致按钮被禁用。我已经尝试了几种方法来组合这两个 Observable,但我发现的每个解决方案都需要两个 Observable 在产生结果之前发布一个事件
我正在尝试让 jquery 在使用 GWT 时为我做一些 ui 影响。我有添加到页面的通知,点击后应该会消失。由于可能有多个相同类型的通知(警告、错误等),我试图仅在通过 GWT 单击它们时才动态添加
我有一组具有以下结构的复选框: A1 A2 ... 复选框仅用于 UI 控制(不用于表单提交)。我有一个关联的 html 元素,它有一个 onclick
作用于 UDP 套接字时,什么会导致 sendto() 发送的字节数少于请求的字节数? 提出这个问题的动机是找出我需要采取的预防措施,以确保我 始终 在一次调用 sendto() 时收到完整的消息,并
我正在编写一个 postgresql View ,它使用一些复杂的逻辑来生成数据行。它要求我对从查询两个不同表的结果派生的两组数据执行相同的一组步骤。是否可以编写一个概括这些步骤的函数? 例如: CR
我想在按下后更改每个图标的颜色。但是 Expandable Container 中的所有图标在按下其中一个后都会发生变化。 class _ExpandableListViewState extends
我正在动态提取 HTML 内容以在我的站点页面中显示注释。问题是我导入的 HTML 内容在样式标签下嵌入了 CSS,所以它基本上扰乱了我的页面样式。有没有什么办法可以阻止传入的样式作用于我的页面? 例
当我将 stdin FD 状态标志设置为 O_NONBLOCK_fileno, F_GETFL); flag = fcntl(stderr->_fileno, F_GETFL); if(-1
我是一名优秀的程序员,十分优秀!