search

Home  >  Q&A  >  body text

javascript - 元素的click和mouseover事件在兄弟结点间触发混乱。

多个兄弟结点,左右触发事件正常,垂直触发事件的时候,明明从兄弟1移动到快到兄弟3才触发兄弟2的事件

sass代码

    .frontPage {
            height:888px;
            width: 600px;
            left: 50%;
            transform: translateX(-50%);
            position: relative;
            text-align:center;
            top:-70px;
            .block {
                height: 150px;
                box-shadow:3px 3px 8px #525252;
                transition: all .4s ease;
                margin-top:20px;
                border:red 1px solid;
            }
            .block:hover{
                    transform:scale(1.2);
            }
    }

节点的截图

错误状态图,鼠标位置在画圈圈位置,但是mouseover事件没有切换到p2块,不懂为什么!

如果由下到上事件也能触发,而且没有问题,从上到下不知道为什么不可以!!!

PHPzPHPz2902 days ago419

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-10 17:07:46

    chrome/safari/firefox下测试没有问题~~

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Title</title>
        <style>
    
            .frontPage {
                height: 888px;
                width: 600px;
                left: 50%;
                transform: translateX(-50%);
                position: relative;
                text-align: center;
                top: -70px;
            }
            .block {
                height: 150px;
                box-shadow:3px 3px 8px #525252;
                transition: all .4s ease;
                margin-top:20px;
                border:red 1px solid;
            }
            .block:hover{
                transform:scale(1.2);
            }
    
        </style>
    </head>
    <body>
        <p class="frontPage">
            <p class="block" style="background-color: red"></p>
            <p class="block" style="background-color: #4a96d3"></p>
            <p class="block" style="background-color: #00a23f"></p>
        </p>
    </body>
    </html>

    reply
    0
  • 怪我咯

    怪我咯2017-04-10 17:07:46

    mouseover:在鼠标指针位于一个元素外部,然后用户将其首次移入另一个元素边界之内时触发。

    reply
    0
  • Cancelreply