MouseLeave mouseout When the suspension box should not disappear when the CSS solution

Source: Internet
Author: User

The effects and code ideas to achieve

In simple terms, a div wrapped with a horn and a hover box hover event is written on this div when the mouse hovers over the DIV and the hover box appears.

The bottom box will not disappear when the mouse is moved from the small speaker to the bottom of the box.

Problems encountered

The problem is that when the mouse moves from the speaker to the top of the hover box, the hover box will disappear when the mouse is moved to the space in the triangle.

Solution Some people say mouseleave time with a timeout to judge, if moved to the bottom of the suspension box (to determine whether to move to the suspended box, to the Suspended box write mouseentered event), the hidden logic stopped on the line, I tried, it is not easy to use

Why the problem occurred

Think carefully, in fact, with a simple CSS can be solved. The problem with the above is that there is a gap between the horn and the suspension frame, so when the mouse moves to the space, it is the same as the focus shifted the div with the horn and the hover box.

Solutions

We just set a div outside the hover box (this div's CSS style is write-only position does not write the background color), this div will be the same as the horn, so that the div and the speaker there is no gap between the mouse hover over the horn, let this div appear, Naturally this div wrapped in a background-colored suspension box will also appear. As long as there is no gap between this div and the speaker, the mouse moves from the horn to the bottom of the suspension box, it will not touch the gap, so the suspension box will not disappear.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.