标签: jquery mouseevent mouseleave
如何解决这个问题会有什么想法。基本上它与子菜单的想法相同。
$(".button").on({ mouseenter: function (e) { //display my other div as a block element and fade it in }, mouseleave: function () { //if my mouse leaves that block element then fade it out. } });
答案 0 :(得分:0)
将CSS中的另一个div设置为display: none,然后使用jQuery的fadeIn()和fadeOut()方法将其打开/关闭:
display: none
fadeIn()
fadeOut()
$(".button").on({ mouseenter: function (e) { $(".other-div").fadeIn(); }, mouseleave: function () { $(".other-div").fadeOut(); } });
请参阅DEMO。