简体   繁体   English

我们如何使 div 在鼠标悬停时跟随 angular 中的 cursor 并在鼠标离开时消失?

[英]How can we make the div follow the cursor in angular when mouse over and disappear when mouse is out?

i have a table with few rows of information as below我有一个表格,其中包含几行信息,如下所示

## html ##
<div>
    <table>
        <thead>
            <tr>
                <th>Name</th>
                <th>email</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td (mouseover)="onMouseDisplay(true)" (mouseleve)="onMouseDisplay(false)">Daya</td>
                <td>d@xxx.mail.com</td>
            </tr>
            <tr>
                <td (mouseover)="onMouseDisplay(true)" (mouseleve)="onMouseDisplay(false)">Vinci</td>
                <td>v@xxx.mail.com</td>
            </tr>
            <tr>
                <td (mouseover)="onMouseDisplay(true)" (mouseleve)="onMouseDisplay(false)">Teju</td>
                <td>t@xxx.mail.com</td>
            </tr>
        </tbody>
    </table>
</div>

div to show conditionally when the mouse is over and disappear when mouse is out i have another div which has to be postioned closer to the tr"rows" and this should only get displayed when the mouseover and should be out on mouseleve div 在鼠标悬停时有条件地显示并在鼠标离开时消失

<div id="moving" *ngIf="isShow">
    <div class="tooltip">
        <p>i'm not moving as per the position of the row items</p>
    </div>
</div>

function to conditionally show/hide function 有条件地显示/隐藏


isShow: boolean;

onMouseDisplay(show: boolean) {
    this.isShow = show;
}

Didn't understood what you want, but you have a misspell in (mouseleave)不明白你想要什么,但你在(mouseleave)中有一个拼写错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM