Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 16:17:20
Original
1313 people have browsed it

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;
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!