jquery 事件 $ele.mousedown().mouseup().html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>jquery $ele.mousedown().mouseup()</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            font: 16px/1.5 FangSong;
        }

        p {
            width: 500px;
            border: 1px dotted green;
            margin: 5px 0 0 5px;
        }
    </style>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script>
        /*参考:https://www.runoob.com/jquery/jquery-events.html*/
        $(document).ready(function () {
            $("#p1").mousedown(function () {
                $(this).css({
                    "font-size": "20px",
                    "transform": "translateY(6px)"
                })
            }).mouseup(function () {
                $(this).css({
                    "font-size": "16px",
                    "transform": "translateY(0px)"
                })
            });
        });
    </script>
</head>
<body>
<p id="p1">这是一个段落</p>
</body>
</html>


发布了197 篇原创文章 · 获赞 61 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/weixin_42193179/article/details/104954308
今日推荐