jQuery示例

Posted 李瑞鑫

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jQuery示例相关的知识,希望对你有一定的参考价值。

1.菜单栏示例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #menu{
            border: 1px solid red;
            width: 200px;
            height: 600px;
        }
        .menu1{
            background-color: #4876FF;
            height: 40px;

        }
        .one{
            padding-left: 50px;
        }
        .one1{
            padding-left: 50px;
        }
        .hide{
            display: none;
        }
        .content span{
            display: block;
            padding-left: 100px;
        }


        .see{
            display: none;
        }
    </style>
</head>
<body>

<div id="menu">
    <div>
        <div class="menu1">菜单1</div>
        <div class="content see">
            <span>1</span>
            <span>2</span>
            <span>3</span>
            <span>4</span>
        </div>
    </div>
        <div>
        <div class="menu1">菜单2</div>
        <div class="content see">
            <span>1</span>
            <span>2</span>
            <span>3</span>
            <span>4</span>
        </div>
    </div>
        <div>
        <div class="menu1">菜单3</div>
        <div class="content see">
            <span>1</span>
            <span>2</span>
            <span>3</span>
            <span>4</span>
        </div>
    </div>


</div>

<script src="high/jquery-1.12.4%20(1).js"></script>
<script>
    $(".menu1").click(function () {
        $(this).next().removeClass("see");
        $(this).parent().siblings().find(".content").addClass("see")
    })
</script>
</body>
</html>
View Code

 2.把默认数据带入到编辑框

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            margin: 0;
        }
        #pg-header{
            background-color: cornflowerblue;
            height: 48px;

        }
        #pg-header-zi{
            color: white;
            font-size: 20px;
            line-height: 48px;

            width: 140px;
            text-align: center;
            float: left;
        }
        #logo{

            border-radius: 50%;
            height: 46px;
            width: 46px;
            margin-left: 40px;
            float: left;
        }
        #xiaoxi{
            float: right;

            height: 48px;
            width: 100px;
            position: relative;

        }
        #user{
            float: right;

            height: 48px;
            width: 100px;
            margin-right: 10px;
            position: relative;
        }
        .pg-header-tu1{
            height: 30px;
            width: 50px;
            padding-top: 8px;
        }
        .pg-header-tu2{
            height: 40px;
            width: 40px;
            line-height: 48px;
            padding-top: 4px;
        }
        .pg:hover{
            background-color: #4876FF;
        }
        #pg-menu{


            position: fixed;
            top:48px;
            bottom: 0;
            width: 20%;
            background-color: #6B6B6B;
        }
        .menu-1{
            height: 50px;
            line-height: 50px;
            border: 1px solid #969696
        }
        .menu-2{
            height: 50px;
            line-height: 50px;
            border: 1px solid #969696;
        }
        .menu-2:hover{
            background-color: #969696;
        }
        #pg-content{
            position: absolute;
            top: 48px;
            bottom: 0;
            right: 0;left: 20%;
            border-top: 25px solid     #E0EEEE;
            border-left: 25px solid     #E0EEEE;
            border-right: 25px solid     #E0EEEE;
        }
        .sp1{
            margin-left: 50px;
            font-weight: bold;

        }
        .sp{
            margin-left: 20px;
            font-weight: bold;
            color: #4876FF;
            font-size: 20px;
        }
        #hide{
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            opacity: 0.4;
            background-color: black;
            z-index: 80;
        }
        #input{
            position: fixed;
            width: 400px;
            height: 200px;
            top: 50%;
            left: 50%;
            margin-top: -100px;
            margin-left: -200px;



            z-index: 100;
            background-color: white;
        }
        .la{
            display: inline-block;
            width: 100px;
            text-align: right;
        }
        .notsee{
            display: none;
        }

    </style>

</head>
<body>
    <div id="pg-header">
        <img  id="logo" src="static/logo2.png" alt="">
        <div id="pg-header-zi">自动化运维平台</div>
        <div class="pg" style="float: right;height: 48px;width: 50px;line-height: 48px;text-align: center;color: white;font-size: 20px;margin-right: 10px">注销</div>
        <div class="pg" style="float: right;height: 48px;width: 50px;line-height: 48px;text-align: center;color: white;font-size: 20px;margin-right: 10px" >注册</div>
        <div class="pg" id="user">
            <img class="pg-header-tu2" src="static/touxiang.png" alt="">
            <span style="color: white;font-size: 20px;position: absolute;top: 13px;right: 8px">admin</span>
        </div>
        <div class="pg" id="xiaoxi">
            <img class="pg-header-tu1" src="static/mail1.png" alt="">
            <span style="color: white;font-size: 20px;position: absolute;top: 13px;right: 8px">消息</span>
        </div>

    </div>
    <div id="pg-menu">
        <div class="menu-1" style="">
            &nbsp;<span style="font-weight: bold;color: white">管理平台</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img style="height: 15px;width: 30px" src="static/xia.png" alt="">
        </div>

        <div>
            <div>
                <div Visual Studio 2012-2019的130多个jQuery代码片段。

markdown 在WordPress中使用jQuery代码片段

使用 NodeJS 和 JSDOM/jQuery 从代码片段构建 PHP 页面

很实用的JQuery代码片段(转)

几个有用的JavaScript/jQuery代码片段(转)

几个非常实用的JQuery代码片段