单击div的滚动条会触发I.E中的模糊事件 [英] Clicking on a div's scroll bar fires the blur event in I.E

查看:109
本文介绍了单击div的滚动条会触发I.E中的模糊事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div,就像下拉一样。因此,当您单击按钮时弹出窗口,它允许您滚动浏览此大列表。所以div有一个垂直滚动条。如果你点击div的外部,即模糊,div应该会消失。

I have a div that acts like a drop-down. So it pops-up when you click a button and it allows you to scroll through this big list. So the div has a vertical scroll bar. The div is supposed to disappear if you click outside of the div, i.e. on blur.

问题是,当用户点击div的滚动条时,IE会错误地触发 onblur 事件,而Firefox没有。我猜Firefox仍然将滚动条视为div的一部分,我认为这是正确的。我只是希望IE的行为方式相同。

The problem is that when the user clicks on the div's scrollbar, IE wrongly fires the onblur event, whereas Firefox doesn't. I guess Firefox still treats the scrollbar as part of the div, which I think is correct. I just want IE to behave the same way.

推荐答案

我遇到类似的问题,当你触发模糊事件时,IE单击滚动条。显然它只发生在IE7及以下,而IE8在quirksmode中。

I'm having a similar problem with IE firing the blur event when you click on a scrollbar. Apparently it only happens n IE7 and below, and IE8 in quirksmode.

这是我通过Google找到的东西

Here's something I found via Google

https://prototype.lighthouseapp.com/projects/8887/tickets/248-results-popup-from-ajaxautocompleter-disappear-when-user-clicks-on-scrollbars-in-ie6ie7

如果你知道那个人在文档上的某个地方点击而不是当前聚焦的div,你基本上只会做模糊。可以反向检测滚动条点击,因为当您单击滚动条时,document.onclick 不会触发。

Basically you only do the blur if you know the person clicked somewhere on the document other than the currently focused div. It's possible to inversely detect the scrollbar click because document.onclick doesn't fire when you click on the scrollbar.

这篇关于单击div的滚动条会触发I.E中的模糊事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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