Home  >  Article  >  Web Front-end  >  Solution to the problem of mouseout triggered by mouse passing option in IE_javascript skills

Solution to the problem of mouseout triggered by mouse passing option in IE_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:17:201307browse

The example in this article describes the solution to the problem of triggering mouseout when the mouse passes the option in IE. Share it with everyone for your reference. The specific analysis is as follows:

Function to be implemented:

There is a DIV. When the mouse passes over the DIV, it is fully expanded. When the mouse is removed, the DIV shrinks back. There is a select box inside the DIV;

A problem will occur in IE when operating select. When the mouse passes over the option, the DIV will shrink back, but this phenomenon does not occur in other browsers.

Solution:

In IE, when the mouse moves to option, the value of window.event.toElement is null, and in other browsers, the value is object;

When the mouse is moved directly out of the DIV, the value of window.event.toElement is object, as are other browsers;

To sum up, you can add the following code to mouseout to solve the problem:

if (window.event.toElement == null) return;

I hope this article will be helpful to everyone’s JavaScript programming design.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn