码迷,mamicode.com
首页 > 其他好文 > 详细

前端 JQ操作

时间:2019-08-07 18:58:01      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:box   doctype   lock   city   ali   生成   切换   pre   char   

jq创建文档

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>jq创建文档</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            background-color: orange;
            float: left;
        }
    </style>
</head>
<body>
    <h1>生成一个box</h1>
    <!--<div class="box"></div>-->
    <!--<div class="box"></div>-->
</body>


</html>

jq的文档操作

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>文档操作</title>
</head>
<body>
    <b class="b1">加粗</b>
    <p class="p1">
        <span>原内容</span>
    </p>
</body>


</html>

jq文档关系

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>jq的文档关系</title>
</head>
<body>
    <div class="wrap">
        <p class="p0">0</p>
        <p class="p1">1</p>
        <p class="t">
            <a href="">2</a>
            <a href="">2</a>
        </p>
        <p class="p3">3</p>
        <p class="p4">4</p>
    </div>
</body>


</html>

jq轮播图案例:包含定时器知识点

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>布局案例</title>
    <link rel="stylesheet" href="css/reset.css">

    <style>
        .scroll-view {
            width: 1226px;
            height: 460px;
            background-color: orange;
            margin: 50px auto 0;

            position: relative;
        }

        .scroll-menu {
            position: absolute;
            background-color: rgba(0, 0, 0, 0.5);
            width: 234px;
            padding: 20px 0;
        }
        .scroll-menu a {
            display: block;
            /*height: 42px;*/
            line-height: 42px;
            color: white;
            /*padding-left: 30px;*/
            text-indent: 30px;
        }
        .scroll-menu a span {
            /*参考的不是a,是ul*/
            position: absolute;
            right: 20px;
        }
        .scroll-menu a:hover {
            background-color: red;
        }

        .scroll-menu-blank {
            width: calc(1226px - 234px);
            height: 460px;
            background-color: red;
            /*参考的是ul*/
            position: absolute;
            top: 0;
            left: 234px;
            display: none;
        }

        .scroll-menu li:hover ~ .scroll-menu-blank {
            display: block;
        }
        .scroll-menu-blank:hover {
            display: block;
        }
    </style>

    <style>
        .scroll-view {
            width: 1226px;
            position: relative;
        }
        .scroll-scroll {
            width: 1226px;
            height: 460px;
            position: absolute;
        }
        .scroll-img li {
            position: absolute;
        }
        .scroll-img a {
            display: block;
        }
        .scroll-img a img {
            width: 100%;
        }
    </style>
    <style>
        .scroll-btn div {
            position: absolute;
            width: 40px;
            height: 70px;
            font-size: 30px;
            line-height: 70px;
            text-align: center;
            color: rgba(0, 0, 0, 0.1);
            cursor: pointer;
        }
        .scroll-btn div:hover {
            background-color: rgba(0, 0, 0, 0.4);
            color: white;
        }
        .scroll-btn-left {
            top: calc(50% - 35px);
            left: 234px;
        }
        .scroll-btn-right {
            top: calc(50% - 35px);
            right: 0;
        }
    </style>
    <style>
        .scroll-point {
            width: 120px;
            height: 40px;
            /*background-color: orangered;*/
            position: absolute;
            right: 10px;
            bottom: 0;
        }
        .scroll-point li {
            float: left;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            border: 2px solid rgba(0, 0, 0, 0.6);
            margin-right: 10px;
            cursor: pointer;
            background-color: rgba(0, 0, 0, 0.3);
        }
        .scroll-point li:hover {
            background-color: white;
        }
    </style>
    <style>
        .scroll-menu, .scroll-btn div, .scroll-point {
            z-index: 2;
        }
        .scroll-img li {
            opacity: 0;
            /*transition: .5s;*/
        }
        .scroll-img li.active {
            opacity: 1;
            z-index: 1;
        }
        .scroll-point li.active {
            background-color: white;
        }
    </style>
</head>
<body>
    <div class="scroll-view">
        <!--轮播图-->
        <div class="scroll-scroll">
            <ul class="scroll-img">
                <li class="active">
                    <a href="https://www.baidu.com">
                        <img src="img/001.png" alt="">
                    </a>
                </li>
                <li>
                    <a href="">
                        <img src="img/002.png" alt="">
                    </a>
                </li>
                <li>
                    <a href="">
                        <img src="img/003.png" alt="">
                    </a>
                </li>
                <li>
                    <a href="">
                        <img src="img/004.png" alt="">
                    </a>
                </li>
                <li>
                    <a href="">
                        <img src="img/005.png" alt="">
                    </a>
                </li>
            </ul>
            <div class="scroll-btn">
                <div class="scroll-btn-left">&lt;</div>
                <div class="scroll-btn-right">&gt;</div>
            </div>
            <ul class="scroll-point">
                <li class="active"></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </div>

        <!--菜单栏-->
        <ul class="scroll-menu">
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <li>
                <a href="">
                    手机电话卡
                    <span>&gt;</span>
                </a>
            </li>
            <div class="scroll-menu-blank">

            </div>
        </ul>
    </div>
</body>



</html>

jq菜单切换

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="css/reset.css">
    <style>
        .menu {
            width: 1226px;
            margin: 0 auto;
        }
        .menu-title {
            width: 100%;
            /*height: 40px;*/
            background-color: #ccc;
        }
        .menu-title:after {
            content: '';
            display: block;
            clear: both;
        }
        .menu-title .l {
            float: left;
        }
        .menu-title .r {
            float: right;
        }
        .menu-title .r li {
            float: left;
            margin-right: 20px;
            /*line-height: 40px;*/
            cursor: pointer;
            padding-top: 10px;
        }
        .menu-title .r li:hover, .menu-title .r li.active {
            color: orangered;
            border-bottom: 2px solid orangered;
        }

        .menu-context {
            width: 100%;
            /*height: 220px;*/
            background-color: pink;
        }
        .menu-context:after {
            content: '';
            display: block;
            clear: both;
        }
        .menu-context li {
            width: 50%;
            float: left;
            height: 220px;
            border-radius: 50%;
            background-color: cyan;
        }
        .menu-context li a {
            display: block;
            font: bold 60px/220px '微软雅黑';
            text-align: center;
            color: red;
        }
    </style>
</head>
<body>
    <div class="menu">
        <ul class="menu-title">
            <li class="l">
                <h1>电子产品</h1>
            </li>
            <li class="r">
                <ul>
                    <li class="active">
                        <span>电视</span>
                    </li>
                    <li>
                        <span>手机</span>
                    </li>
                    <li>
                        <span>电脑</span>
                    </li>
                </ul>
            </li>
        </ul>
        <ul class="menu-context">
            <li>
                <a href="https://www.baidu.com">电视1</a>
            </li>
            <li>
                <a href="https://www.baidu.com">电视2</a>
            </li> 
        </ul>
    </div>
</body>


</html>

前端 JQ操作

标签:box   doctype   lock   city   ali   生成   切换   pre   char   

原文地址:https://www.cnblogs.com/bladecheng/p/11317052.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!