首页 前端知识 jquery Bootstrap作品实现教程

jquery Bootstrap作品实现教程

2024-05-10 22:05:53 前端知识 前端哥 952 885 我要收藏

一、 需求分析

要求:作品实现本地存储和增删改查

由于当时没有规定作品必须写什么,所以这时候就是发挥创意,这里写了一个原神角色展示页面,在这个基础上结合作品要求,与官网页面有差距。

二、最终结果

 三、代码实现

1. 由于用到了jQuery和Bootstrap,所以要先去官网引入相关标签

<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>

<script src="/原神/bootstrap1.min.js"></script>

 因为我的Bootstrap是下载下来的,所以直接是本地路径,jQuery是引用网上的

2. HTML代码

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>

    <script src="/原神/bootstrap1.min.js"></script>

    <link rel="stylesheet" href="/原神/bootstrap.min.css">

    <title>《原神》官方网站-角色</title>

    <link rel="stylesheet" href="gaunwang.css">

</head>

<body>

    <div class="container">

        <div class="header">

            <div class="header-wrap">

                <div class="header-wrap-left">

                    <ul>

                        <li>首页</li>

                        <li>新闻</li>

                        <li class="header-active" style="line-height: 56px;color: white;">角色</li>

                        <li>世界</li>

                        <li>漫画</li>

                        <li>社区</li>

                    </ul>

                </div>

                <div class="header-wrap-found">

                   

                    <button class="btn btn-default btn-primary" data-toggle="modal" data-target="#myModel">增加</button>

                    <input type="text" id="found-person">

                    <button id="found">查找</button>

                </div>

            </div>

        </div>

        <div class="center">

            <img src="/原神/jq_原神/璃月港.jpg" alt="">

            <ul class="center-city">

                <li>蒙德城</li>

                <li id="center-active">璃月港</li>

                <li>稻妻城</li>

                <li>敬请期待</li>

            </ul>

            <ul class="center-porsen">

                <li>

                    <img src="/原神/jq_原神/魈.png" alt="" id="big-picture">

                    <div class="big-name">

                        魈

                    </div>

                    <div class="person-cv">

                        CV:

                        <div class="cv-name">

                            kinsen

                        </div>

                        <button class="btn btn-primary rev" data-toggle="modal" data-target="#myModal">修改</button>

                        <div class="revl">

                            点击修改角色cv

                        </div>

                    </div>

                </li>

            </ul>

            <ul class="center-little">

                <div class="little-list">

                    <li class="list">

                        <img src="/原神/jq_原神/小头像_魈.png" alt="" class="little-delet">

                        <div class="person-name">魈</div>

                        <button class="delet">删除</button>

                    </li>

                </div>

            </ul>

        </div>

    </div>

    <!-- 添加的模态框 -->

    <div class="modal fade" id="myModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

        <div class="modal-dialog">

            <div class="modal-content">

                <div class="modal-header">

                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>

                    <h4 class="modal-title" id="myModalLabel">增加信息</h4>

                </div>

                <div class="modal-body">

                    <form>

                        <div>

                            <input type="text" placeholder="角色名字" id="name" class="form-control" />

                        </div>

                        <div class="cv">

                            <input type="text" placeholder="CV" id="cv" class="form-control" />

                        </div>

                    </form>

                </div>

                <div class="modal-footer">

                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>

                    <button type="button" class="btn btn-primary aad" data-dismiss="modal">增加信息</button>

                </div>

            </div>

            <!-- /.modal-content -->

        </div>

        <!-- /.modal -->

    </div>

    <!-- 修改的模态框 -->

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

        <div class="modal-dialog">

            <div class="modal-content">

                <div class="modal-header">

                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>

                    <h4 class="modal-title" id="myModalLabel">修改信息</h4>

                </div>

                <div class="modal-body">

                    <form>

                        <div class="form-group">

                            <input type="text" placeholder="修改前的角色cv" id="reusr" class="form-control" />

                        </div>

                        <div class="form-group">

                            <input type="text" placeholder="修改后的角色cv" id="reusrnum" class="form-control" />

                        </div>

                    </form>

                </div>

                <div class="modal-footer">

                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>

                    <button type="button" class="btn btn-primary olk" data-dismiss="modal">提交更改</button>

                </div>

            </div>

            <!-- /.modal-content -->

        </div>

        <!-- /.modal -->

    </div>

    <script src="guanwang.js"></script>

</body>

</html>

3. css代码

body{

    margin: 0;

    padding: 0;

}

ul,li,ol{list-style-type: none;padding: 0;margin: 0;}

a{text-decoration: none;}

.container{

    margin: 0;

    width: 100%;

    max-width: 100%;

    padding: 0;

}

.header{

    background-color: rgba(90, 90, 90,.6);

    width: 100%;

    height: 66px;

    position: relative;

    z-index: 4;

}

.header-wrap{

    background-color: rgba(90, 90, 90,.6);

    width: 100%;

    height: 66px;

}

.header-wrap ul{

    float: left;

    display: flex;

}

.header-wrap ul li{

    font-size: 20px;

    font-weight: normal;

    font-stretch: normal;

    letter-spacing: 0px;

    color: #ccc;

    text-align: center;

    cursor: pointer;

    margin: 0 30px ;

    height: 66px;

    line-height: 66px;

}

.header-active{

   

    border-top: 5px solid #69e0ff;

}

.header-wrap-found{

    float: right;

    margin: 15px 30px 0 0;

}

.header-wrap-found input{

    background-color: rgb(194, 194, 194);

    height: 30px;

    line-height: 30px;

    border-radius: 5px;

    outline: none;

}

.header-wrap-found button{

    background-color: rgb(194, 194, 194);

    height: 35px;

    line-height: 30px;

    border-radius: 5px;

}

.center{

    position: relative;

    top: -70px;

    bottom: 0;

    left: 0;

    right: 0;

}

.center img{

    width: 100%;

    height: 760px;

}

.center-city{

    position: absolute;

    top: 300px;

    left: 40px;

    position: absolute;

    z-index: 9;

    width: 370px;

    height: 100%;

    box-sizing: border-box;

    height: 216px;

}

.center-city li{

    padding-left: 30px;

    cursor: pointer;

    height: 54px;

    line-height: 40px;

    font-size: 18px;

    color: #fff;

    width: 100%;

    background-repeat: no-repeat !important;

    background-position: 20px 0 0 0;

    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9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gAAAHhJREFUeNrs18EKgCAQRVGNftsJ6sNHW0QuXNUzBroPZiUMB0ZFs7unyFlS8AAECBAgQIAAAQLsY62KtOP5YBXV5neKqu8MnBQ5C3fF3vZX7EF/uPbpHrTIIx4hZYdkFV4IezfWQ9U08y8GCBAgQIAAAQL8NbAKMAD/HXfdYwQY6gAAAABJRU5ErkJggg==)  ;

}

#center-active{

    width: 370px;

    height: 54px;

    line-height: 40px;

    padding-left: 60px;

    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUYAAAA2CAYAAAC7gjCFAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMcBsHW/a6lbANpWAGjf+V0z2wmgWgrQevmLeTj8QB6eoVDIPB0cCgsL7SViob0w44s+/zPhb+CLfvb8QB7+23rwAHGaQJmtwKOD/XFhbnauUo7nywRCMW735yP+x4V//Y4p0eI0sVwsFYrxWIm4UCJNx3m5UpFEIcmV4hLpfzLxH5b9CZN3DQCshk/ATrYHtctswH7uAQKLDljSdgBAfvMtjBoLk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zoYoRtf5oGwDIw/Q0CmBXSakdwFPjDTGLkYz+aJSjNBgGXeAJST9xOTH48yd+mI6lrqCMhV1AOaPmHKLWW06Pt/3aKMSIEBVUd0ftnPIOzSlYZ1dw6HH1lQxhrbG3UwP2GimNKUNaF01Mo9qc5mZpkBEVYm6TGxwHIcpktyk452r2C4lx9IFWEEAvs1n6FPdocoqdt/kGGZ6m22MO1XI9RtN8mYR250S7fH/AgwAcLo2Eoki2tsAAAAASUVORK5CYII=);

}

.center-little{

    display: flex;

    position: absolute;

    left: 0;

    /* top: 0; */

    bottom: 4px;

    width: 100%;

    height: 230px;

    background-color: rgba(90, 90, 90,.4);

}

.center-little li img{

    width: 106px;

    height: 106px;

}

.person-name{

    color: white;

    font-size: 20px;

    width: 106px;

    height: 30px;

    line-height: 30px;

    text-align: center;

    cursor: pointer;

}

.little-list{

    width: 1000px;

    margin: 0 auto;

    box-sizing: border-box;

    padding-top: 35px;

    overflow-x: scroll;

}

.center-porsen{

    position: absolute;

    top: 0px;

    left: 250px;

    width: 1300px;

    height: 100%;

}

.big-name{

    position: absolute;

    top: 200px;

    left: 200px;

    font-size: 80px;

    color: white;

    width: 400px;

    height: 400px;

}

.person-cv{

    position: absolute;

    top: 350px;

    left: 200px;

    font-size: 30px;

    border: 2px solid #f79b50;

    background-color: #f3a86b;

    width: 200px;

    height: 50px;

    line-height: 50px;

    /* text-align: center; */

}

.cv-name{

    width: 130px;

    position: absolute;

    top: 0px;

    left: 70px;

}

.little-list li{

    float: left;

    margin-right: 40px;

}

.rev{

    font-size: 16px;

    position: absolute;

    top: 60px;

    left: 0;

}

.revl{

    font-size: 18px;

    color: white;

    position: absolute;

    left: 70px;

    top: 55px;

}

.delet{

    margin-left: 30px;

}

3. js代码

//本地存储数组

function getList() {

    let data = localStorage.getItem('todolist');

    if (data !== null) {

        //本地存储的数据是字符串格式的,但是要转化对象格式

        // console.log( JSON.parse(data));

        return JSON.parse(data);

    } else {

        return [];

    }

}

var flag = false;

//数组去重

function arrsa(newInput, flag) {

    let data = getList();

    for (let i = 0; i < data.length; i++) {

        if (data[i].name == newInput) {

            flag = true;

            break;

        }

    }

    return flag;

}

load();

//渲染

function load() {

    let data = getList();

    for (let i = 0; i < data.length; i++) {

        if (data[i].disp == true) {

            $(".big-name").text(data[i].name)

            $(".cv-name").text(data[i].cv1)

            $("#big-picture").attr("src", data[i].pot)

        }

    }

    $(".little-list").empty();

    $.each(data, function (i, n) {

        $(".little-list").append(`<li id = ` + i + ` class="list">

        <img src="/原神/jq_原神/小头像_`+ n.name + `.png" alt="" id = "little-person">

        <div class="person-name">`+ n.name + `</div>

        <button class="delet">删除</button>

    </li>

    `)

    })

}

//保存本地存储的数据

function setDat(dat) {

    localStorage.setItem('todolist', JSON.stringify(dat));

}

$(document).on("click", ".aad", function () {

    let data = getList();

    let inputname = $("#name").val();

    let inputcv = $("#cv").val();

    let littleImg = '/原神/jq_原神/小头像_' + inputname + '.png'

    let imgUrl = "/原神/jq_原神/" + inputname + ".png";

    if ($("#name").val().trim() !== '' && $("#cv").val().trim() != '' && !arrsa(inputname, flag)) {

        // console.log('dsf');

        data.push({

            name: inputname,

            cv1: inputcv,

            pot: imgUrl,

            litte: littleImg,

            disp: false

        })

    }

    setDat(data);

    load();

})

//这是修改功能

$(document).on("click", ".olk", function () {

    let data = getList();

    // let oldCv = $("#reusr").val();

    // console.log($("#reusr").val());

    let newCv = $("#reusrnum").val();

    if ($("#reusr").val().trim() !== '' && $("#reusrnum").val().trim() !== '') {

        for (let i = 0; i < data.length; i++) {

            if ($("#reusr").val() == data[i].cv1) {

                data[i].cv1 = newCv;

                break;

            }

        }

        setDat(data);

        load();

    } else {

        alert('输入值不能为空');

    }

})

//这是删除功能

$(document).on("click", ".delet", function () {

    // alert('被双击了');

    let data = getList();

    let m = $(this).index(".delet");

    console.log(m);

    data.splice(m, 1);

    if (data[m].disp == true) {

        for (let i = 0; i < data.length; i++) {

            data[i].disp = false;

        }

        data[m - 1].disp = true;

        $(".big-name").text(data[m - 1].name)

        $(".cv-name").text(data[m - 1].cv1)

        $("#big-picture").attr("src", data[m - 1].pot)

    }

    setDat(data);

    load();

})



 

//点击将小头像显示为大图

$(document).on("click", ".list", function () {

    // console.log(m);

    let data = getList();

    let m = $(this).index(".list");

    for (let i = 0; i < data.length; i++) {

        data[i].disp = false;

    }

    data[m].disp = true;

    $(".big-name").text(data[m].name)

    $(".cv-name").text(data[m].cv1)

    $("#big-picture").attr("src", data[m].pot)

    setDat(data);

    load();

})

//查找功能

$(document).on("click", "#found", function () {

    let data = getList();

    // console.log($("#found-person").val());

    for (let i = 0; i < data.length; i++) {

        data[i].disp = false;

        if (data[i].name == $("#found-person").val()) {

            data[i].disp = true;

            $(".big-name").text(data[i].name)

            $(".cv-name").text(data[i].cv1)

            $("#big-picture").attr("src", data[i].pot)

        }

    }

    // $("#found-person").val() = ''

    setDat(data);

    load();

})

四、概述

1. 作品中需要的图片是从官网下载的

2. 页面不可以在“蒙德”和“璃月”或者“稻妻”之前切换,上面的导航栏也不能切换,原因是,作品不需要,另外时间紧张

3. 一点点题外话,我爱胡桃

转载请注明出处或者链接地址:https://www.qianduange.cn//article/8035.html
标签
bootstrap
评论
发布的文章

JQuery中的load()、$

2024-05-10 08:05:15

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!