滑过显示消息提示框(提示框与标题分离)

此效果指的是划过的和显示的内容不在划过的标题的内容里

效果如下

代码如下

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8"/>
    <style>
        *{padding: 0;margin: 0;list-style: none;}
        .ts-p:hover{color: #0f0;}
        .tsDiv{display: none;position: absolute;left: 10px;top:20px;width: 200px;border:1px solid #096542;padding: 10px;}
    </style>
</head>
<body>
    <p class="ts-p">滑过显示提示</p>
    <div class="tsDiv">
        <h3>注意事项:</h3>
        <p>1.必须穿皮鞋</p>
        <p>2.必须穿西装</p>
    </div>
    <script src="jquery-1.11.3.min.js"></script>
    <script>
        $(function(){
            var timer = null;
            $('.ts-p').on('mouseenter', function () {
                clearTimeout(timer);
                $('.tsDiv').fadeOut();
                if (!$('.tsDiv').is(":animated")) {
                    $('.tsDiv').fadeIn();
                }
            });
            $('.ts-p').on('mouseleave', function () {
                timer = setTimeout(function () {
                    $('.tsDiv').fadeOut();
                }, 1000)
            });
            $('.tsDiv').hover(function () { clearTimeout(timer); }, function () { $(this).fadeOut(); });
        })
    </script>
</body>
</html>

 

转载于:https://www.cnblogs.com/shanshanjiadexiaohai/p/11187589.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值