博主网站(未完善)
博主首页

目录

01图标库
02插件安装

01条件渲染
02列表渲染
03模板渲染
04计算属性
05侦听器
06样式绑定
07样式
08事件
09表单输入绑定
10生命周期
11组件
12脚手架
13vue-router
14vuex
15拖拽
16组件间传递

01HTML元素
02CSS样式

01filter、find……
02匿名函数……
03动态拼接地址
04vh、vm
05vue中ref
06js类型判断
07插槽
08富文本编辑器
09javaScript
10watch监听
11依赖注入
12ES6运算符
13flex-direction
14本地存储
15随机颜色
16中间延申
17多次触发问题
18nvm安装
19表单数据动态
20持久化存储
21$nextTick
22::v-deep
23tab失灵
25封装表单验证
26电梯导航栏
27页面滚动渐入动画

css3基础01

01bs列表
02bs栅格
03bs表单
更新中......

其他17---解决onmouseover多次触发问题

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .bo{
            width:100%;
            background-color: #7fffd4;
            transition:top 1.5s;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="box1" style="position:relative;width:500px;height:300px;border:1px solid red;overflow: hidden;">
            <img src="./image/4.jpg" alt="" style="width:500px;height:300px;">
            <div style="position:absolute;top:240px;background-color: bisque;" class="bo">
                <h3>你好明天</h3>
                <p>你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天你好明天</p>
            </div>
        </div>
    </div>
    <script>           
        var item=document.getElementsByClassName('box1')[0] 
        var bo=document.getElementsByClassName('bo')[0] 
        item.onmouseover = function(ev)
        {
            var ev=ev||window.event;
                if(!isMouseLeaveOrEnter(ev,this)){return false;}
            bo.style.top=0+'px'
        };
item.onmouseout = function(ev) { var ev=ev||window.event; if(!isMouseLeaveOrEnter(ev,this)){return false;} bo.style.top=240+'px' };
//消除onmouseover和onmouseout重复执行,这是关键代码 function isMouseLeaveOrEnter(e, handler) { if (e.type != 'mouseout' && e.type != 'mouseover') return false; var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement; while (reltg && reltg != handler) reltg = reltg.parentNode; return (reltg != handler); } </script> </body> </html>

  

posted @ 2022-04-01 03:56  !ment  阅读(290)  评论(0编辑  收藏  举报