jquery .hover() 和 .show()
我想当鼠标进入
时隐藏
,当鼠标离开
时它应该重新出现.现在我只是隐藏了
但当鼠标离开
时它不会重新出现i want to hide a <div>
when mouse enters the <div>
and it should reappear when mouse leaves the <div>
.right now i just hid the <div>
but it's not reappearing when mouse leaves the <div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了详细说明@rob.alarcon的答案,你必须记住
.hover
方法的API是:由于你没有发布你的代码,我不能给你一个明确的答案,但是你需要记住为“悬停”和“悬停”事件提供处理程序。意思是,听起来您有一个有效的方法来处理鼠标进入元素时触发的事件,但是您是否还为鼠标离开元素时提供了一个事件处理程序?
显然,这不是您想要在生产站点中执行的操作,但您始终可以在这两种方法中抛出
alert()
消息,以便您明确知道事件正在被处理。HTH。
To elaborate on @rob.alarcon's answer, you have to remember the API for the
.hover
method is:Since you didn't post your code, I can't give you a definite answer, but you need to remember to provide a handler for both the "hover in" and "hover out" events. Meaning, it sounds like you have a valid method to handle the event that is triggered when the mouse enters the element, but did you also provide an event handler for when the mouse leaves the element?
It's not something you want to do in a production site, obviously, but you could always throw an
alert()
message in both methods so that you know explicitly that the events are being handled.HTH.