jQuery:暂时禁用悬停...意想不到的副作用 [英] jQuery: temporarily disable hover... unintended side effect

查看:109
本文介绍了jQuery:暂时禁用悬停...意想不到的副作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了.hover()的问题。我想暂时禁用它,这是我做的,但它有一个意想不到的副作用,我想摆脱。



以下是我的小提琴:< a href =http://jsfiddle.net/sdPVG/7/ =nofollow> http://jsfiddle.net/sdPVG/7/

我试图在工具提示和下拉菜单打开时禁用悬停(topTip和topDrop)。点击红色图标(topIconNew)打开这些div,这会扩大工具提示。不幸的是,工具提示在点击后会永久扩展。我希望div恢复到正常(较窄)的状态。我哪里错了?

任何和所有的帮助表示赞赏。谢谢!

使用动画改变了topTip div的大小......它需要被重新设置为原始大小尺寸。

  $(document).click($ b $)将您的//隐藏下拉框和工具提示点击外部功能更改为: b函数(){
hoverEnabled = true;
$('div.topTip')。animate({width:100,marginLeft:0},'fast');
$(' div.topTip,div.topDrop')。hide();
}
);


I've ran into a problem with .hover(). I want to temporarily disable it, which I've done, but it's had an unintended side effect that I want to get rid of.

The following is my fiddle: http://jsfiddle.net/sdPVG/7/

I am trying to disable the hover while the tooltip and dropdown menus are open (topTip and topDrop). These divs open upon clicking the red icon (topIconNew) and this widens the tooltip. Unfortunately, the tooltip stays permanently widened after it's been clicked. I want the div to return to it's normal (narrower) state though. Where have I went wrong?

Any and all help appreciated. Thanks!

解决方案

You changed the size of the topTip div with an animation ... it needs to be set back to it's original size. Change your "// hide dropdown and tooltip on click outside" function to :

$(document).click(
    function(){
        hoverEnabled = true;
        $('div.topTip').animate({width:100,marginLeft:0},'fast');
        $('div.topTip, div.topDrop').hide();
    }
);

这篇关于jQuery:暂时禁用悬停...意想不到的副作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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