boostrap布局( 二)—后台布局实例(左侧菜单激活、右边页面切换)

五、Bootstrap之菜单栏和导航栏 本文主要学习 Bootstrap 中提供的菜单栏和导航栏组件的使用方法和样式,按照 Bootstrap 的规范正确构建菜单栏和导航栏的 HTML 结构。Bootstrap 类:熟悉并正确应用 Bootstrap 的类名,如.navbar.nav.nav-item.nav-link等。响应式设计:学习如何使用 Bootstrap 的响应式工具类来确保菜单栏和导航栏在不同屏幕尺寸下的良好显示效果。1、通过在代码编辑器中实际编写代码,尝试创建不同样式的菜单栏和导航栏,加深理解和熟练应用; 阅读详情

实际项目效果如下:

选中左侧菜单,右边自动变换页面。默认选中Page1页面产品信息。

index.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Bootstrap 布局实例</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse" role="navigation">
    <div class="container-fluid">
              <div class="collapse navbar-collapse" id="example-navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="active"><a class="icon-bar" href="#">mylastday系统</a>
                </li>
                <li><a href="#">菜单1</a>
                </li>
                <li><a href="#">菜单2</a>
                </li>
                <li><a href="#">菜单3</a>
                </li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a>欢迎您,admin</a>
                </li>
                <li><a href="#">安全退出</a>
                </li>
            </ul>
        </div>
    </div>
</nav>


<div class="container-fluid">
    <div class="row">
        <div class="col-sm-2" id="menulist">
            <a href="#" class="list-group-item active" onclick="loadPage('page1')">
                <!-- 小图标样式设置 -->
                产品信息</a>
            <a href="#" class="list-group-item" onclick="loadPage('page2')">
                大屏信息 </a>
            <a href="#" class="list-group-item" onclick="loadPage('page3')">
                用户管理</a>
            <a href="#" class="list-group-item">
                菜单4</a>
            <a href="#" class="list-group-item">
                菜单5</a>
            <a href="#" class="list-group-item">
                菜单6</a>
            <a href="#" class="list-group-item">
                菜单7</a>
        </div>
        <!--左边菜单栏-->
        <div class="col-sm-10" id="right">
            <ol class="breadcrumb">
                <li class="active">菜单
                </li>
                <li class="active">用户信息
                </li>
            </ol>

            <div class="panel panel-default">
                <div class="panel-heading">
                    搜索
                </div>
                <div class="panel-body">
                    <form role="form" class="form-inline">
                        <div class="form-group">
                            <label for="name">姓名</label>
                            <input type="text" class="form-control" id="name" placeholder="请输入姓名">
                        </div>
                        <div class="form-group">
                            <label for="name">状态</label>
                            <select class="form-control">
                                <option>正常</option>
                                <option>禁用</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <button type="submit" class="btn btn-default">开始搜索</button>
                        </div>
                    </form>
                </div>
            </div>
            <!--
                列表展示
            -->
            <div class="table-responsive">
                <table class="table table-striped ">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>用户名</th>
                        <th>性别</th>
                        <th>年龄</th>
                        <th>邮箱</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>15</td>
                        <td>ZZZ</td>
                        <td>女</td>
                        <td>33</td>
                        <td>aaa@163.com</td>
                        <td>正常</td>
                        <td>
                            <div class="btn-group">
                                <a href="" class="btn btn-default">修改</a><a href="" class="btn btn-default">禁用</a><a href="" class="btn btn-danger">删除</a>
                            </div>

                        </td>
                    </tr>

                    </tbody>
                </table>
            </div>
            <ul class="pagination" style="float: right;">
                <li><a href="#">&laquo;</a>
                </li>
                <li class="active"><a href="#">1</a>
                </li>
                <li class="disabled"><a href="#">2</a>
                </li>
                <li><a href="#">3</a>
                </li>
                <li><a href="#">4</a>
                </li>
                <li><a href="#">5</a>
                </li>
                <li><a href="#">&raquo;</a>
                </li>
            </ul>
        </div>
    </div>
</div>
<!-- 底部页脚部分 -->
<div class="footer">
    <p class="text-center">
        2019 &copy; mylastday.
    </p>
</div>
</body>
<script>
  /*
         * 对选中的标签激活active状态,对先前处于active状态但之后未被选中的标签取消active
         * (实现左侧菜单中的标签点击后变色的效果)
         */
        $(document).ready(function () {
            $('#menulist> a').click(function (e) {
                //e.preventDefault();    加上这句则导航的<a>标签会失效
                $('#menulist> a').removeClass('active');
                $(this).addClass('active');
            });
        });


    function loadPage(url) {
           $.get(url,function(data,status){
           $("#right").html(data);
  });
        }
</script>
</html>>

page1.html 

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Dashboard Template for Bootstrap</title>
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

        <div class="col-sm-12 column">
            <ol class="breadcrumb">
                <li class="active">菜单
                </li>
                <li class="active">产品信息
                </li>
            </ol>
            <table class="table">
                <thead>
                <tr>
                    <th>
                        编号
                    </th>
                    <th>
                        产品
                    </th>
                    <th>
                        交付时间
                    </th>
                    <th>
                        状态
                    </th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>
                        1
                    </td>
                    <td>
                        TB - Monthly
                    </td>
                    <td>
                        01/04/2012
                    </td>
                    <td>
                        Default
                    </td>
                </tr>
                <tr class="success">
                    <td>
                        1
                    </td>
                    <td>
                        TB - Monthly
                    </td>
                    <td>
                        01/04/2012
                    </td>
                    <td>
                        Approved
                    </td>
                </tr>
                <tr class="error">
                    <td>
                        2
                    </td>
                    <td>
                        TB - Monthly
                    </td>
                    <td>
                        02/04/2012
                    </td>
                    <td>
                        Declined
                    </td>
                </tr>
                <tr class="warning">
                    <td>
                        3
                    </td>
                    <td>
                        TB - Monthly
                    </td>
                    <td>
                        03/04/2012
                    </td>
                    <td>
                        Pending
                    </td>
                </tr>
                <tr class="info">
                    <td>
                        4
                    </td>
                    <td>
                        TB - Monthly
                    </td>
                    <td>
                        04/04/2012
                    </td>
                    <td>
                        Call in to confirm
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
</body>
</html>

page2.html 效果如下

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Dashboard Template for Bootstrap</title>
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-sm-11 column">
            <ol class="breadcrumb">
                <li class="active">菜单
                </li>
                <li class="active">大屏信息
                </li>
            </ol>
            <div class="jumbotron">
                <h1>
                    Hello, world!
                </h1>
                <p>
                    This is a template for a simple marketing or informational website. It includes a large callout
                    called the hero unit and three supporting pieces of content. Use it as a starting point to create
                    something more unique.
                </p>
                <p>
                    <a class="btn btn-primary btn-large" href="#">Learn more</a>
                </p>
            </div>
        </div>
    </div>
</div>
</body>
</html>

page3.html  效果如下:

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Dashboard Template for Bootstrap</title>
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
  <div class="col-sm-12" id="right">
        <ol class="breadcrumb">
            <li class="active">菜单
            </li>
            <li class="active">用户管理
            </li>
        </ol>

        <div class="panel panel-default">
            <div class="panel-heading">
                搜索
            </div>
            <div class="panel-body">
                <form role="form" class="form-inline">
                    <div class="form-group">
                        <label for="name">姓名</label>
                        <input type="text" class="form-control" id="name" placeholder="请输入姓名">
                    </div>
                    <div class="form-group">
                        <label for="name">状态</label>
                        <select class="form-control">
                            <option>正常</option>
                            <option>禁用</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-default">开始搜索</button>
                    </div>
                </form>
            </div>
        </div>
        <!--
            列表展示
        -->
        <div class="table-responsive">
            <table class="table table-striped ">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>用户名</th>
                    <th>性别</th>
                    <th>年龄</th>
                    <th>邮箱</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>15</td>
                    <td>ZZZ</td>
                    <td>女</td>
                    <td>33</td>
                    <td>aaa@163.com</td>
                    <td>正常</td>
                    <td>
                        <div class="btn-group">
                            <a href="" class="btn btn-default">修改</a><a href="" class="btn btn-default">禁用</a><a href="" class="btn btn-danger">删除</a>
                        </div>

                    </td>
                </tr>

                </tbody>
            </table>
        </div>
        <ul class="pagination" style="float: right;">
            <li><a href="#">&laquo;</a>
            </li>
            <li class="active"><a href="#">1</a>
            </li>
            <li class="disabled"><a href="#">2</a>
            </li>
            <li><a href="#">3</a>
            </li>
            <li><a href="#">4</a>
            </li>
            <li><a href="#">5</a>
            </li>
            <li><a href="#">&raquo;</a>
            </li>
        </ul>
    </div>
</div>
</body>
</html>

3. 实际项目里的juery代码--激活菜单,切换页面

<script>
  /*
         * 对选中的标签激活active状态,对先前处于active状态但之后未被选中的标签取消active
         * (实现左侧菜单中的标签点击后变色的效果)
         */
        $(document).ready(function () {
            $('#menulist> a').click(function (e) {
                //e.preventDefault();    加上这句则导航的<a>标签会失效
                $('#menulist> a').removeClass('active');
                $(this).addClass('active');
            });
        });


    function loadPage(url) {
           $.get(url,function(data,status){
           $("#right").html(data);
  });
        }
</script>
使用Boostrap制作导航栏和汉堡按钮 导航栏制作 使用Boostrap制作基础导航栏主要分为以下步骤: 1.事先引入jquery.js、boostrap.min.js和boostrap.min.css文件。 2.添加一个<div>标签或者一个容器<nav>,使用.navbar类和.navbar-default类,并添加role=“navigation”(增加可访问性)。 3.在上面的标签或容器内再添加一个div... 阅读详情

相关推荐

构建基于Bootstrap的响应式右键菜单

在一些特殊情况下,内置的样式可能无法满足设计要求。这时,我们可以自定义CSS来进一步改变表格的外观。以下是一些可能的自定义CSS代码:jQuery是一个快速、小巧、功能丰富的JavaScript库,它简化了HTML文档遍历、事件处理、动画和Ajax交互。自从2006年问世以来,jQuery就因其跨浏览器兼容性和简洁的语法而在开发社区中备受欢迎。使用jQuery,开发者可以将注意力集中在实现功能上,而不是花时间去解决不同浏览器之间的兼容问题。

weixin_31419153的博客 931

bootstrap如何实现左侧导航栏,右侧网页

方式一:采用iframe,即将网页放入iframe这个容器中。 方式二:采用div的话绑定a或者li的点击事件 阻止a的默认行为,用jquery的load()可以来加载这个div,即将网页放入div中。 方式三:angular的嵌套路由也可以实现。不过本人对angular不是很了解,所以这种方式没有去试。 方式四:采用ajax技术,实现局部刷新。(本人觉得该方式比较麻烦,就不

lantingyue11的博客 5万+

左侧菜单栏控制右侧页面内容切换

本demo所需技术:jQuery+Bootstrap 本demo所用工具:IDEA 本demo主要实现功能: 1. 左侧菜单栏切换右侧页面内容 2. boostrap弹框内容的显示

【2】案例:Bootstrap 开发 - navs 左侧菜单,使用iframe 嵌入*.html实现动态切换页面

一、效果展示 1、div实现效果 2、iframe实现效果 二、左侧菜单栏样式 菜鸟左侧菜单栏中有5个示例,基本满足了大部分场景需求。 参考文档:Bootstrap5 侧边栏导航(Offcanvas) | 菜鸟教程 我这里采用的是第4个样式,这个样式只展示了左侧菜单栏。 接下来我将实现左侧菜单栏和右侧主界面的联动跳转。 三、菜单栏和右侧主界面的联动跳转 有2中比较常用的实现方式: 1、使用div实现主界面切换 实现思路 动态监听 a 的 click事件;..

记录项目交付的日常 1万+

bootstrap 风格左侧菜单

NULL 博文链接:https://davidhhs.iteye.com/blog/2325967

四自由度SCARA机器人的运动学和动力学MATLAB建模与仿真

本文介绍了四自由度SCARA机器人的运动学和动力学建模,使用MATLAB进行了相应的建模与仿真。通过正运动学和动力学分析,可以了解机器人在不同状态下的运动特性和力学特性。这为后续的控制算法设计和性能优化打下了基础。希望本教程对学习SCARA机器人有帮助。

小蜗牛的珍贵百宝箱 3649

使用Boostrap V4,左侧菜单栏可缩进,并根据屏幕宽度自适应大小。

为什么80%的码农都做不了架构师?>>> ...

weixin_34288121的博客 2051

SpringCloud2025+SpringBoot3.5.0动态路由503问题排查与负载均衡依赖解析

本文详细排查了SpringCloud 2025与SpringBoot 3.5.0环境下,Spring Cloud Gateway动态路由返回503错误的根本原因。核心问题在于新版网关未默认集成负载均衡器,导致无法解析lb://服务名。通过对比静态路由与动态路由,定位到需显式引入spring-cloud-starter-loadbalancer依赖,并提供了完整的解决方案与最佳实践配置。

s3t4u的博客 506

基于Boostrap的H+ 后台主题UI框架(开源)

目录H+ 后台主题 UI 框架H+的布局及几种常用UI组件H+是一款常用后台主题UI框架。首发于 2013 年,由 Zihan's Blog 开发并维护,属于国内早期做中后台 UI 框架的产品,在国内拥有广泛的用户基础。由于作者自身原因,该框架已停止维护,现由官方采用 MIT 协议面向社区开源。

eqilin2022的博客 4397

【雷达成像实战】RD、CS、RMA算法对比与Matlab实现:从信号处理到高清成像

本文深入对比了雷达成像中三种核心算法:经典的距离多普勒算法(RD)、基于稀疏重建的压缩感知算法(CS)以及高精度的快速多通道获取算法(RMA)。通过详细的Matlab实战代码,从原理拆解到实现步骤,分析了各自在计算效率、成像精度、数据需求和适用场景上的优劣,为工程选型与算法实践提供了清晰指南。

weixin_29095587的博客 454

智驾系统分层架构:从传感器到执行器的全链路解析

本文深入解析了智能驾驶系统的分层架构,从传感器数据采集融合、应用层决策到车辆管理层执行,完整呈现了从感知到控制的全链路工作流程。文章重点阐述了架构设计的核心优势在于接口标准化与模块解耦,以ACC和LKA协同场景为例,说明了各层级如何通过清晰分工与高效协作,实现复杂系统的可靠、灵活与易于升级。

weixin_29219189的博客 404

Boostrap框架学习总结

Boostrap框架学习总结 Boostrap上礼拜就学习完了,最大的感受就是 方便。导航栏,下拉菜单,面板,表单控件等等 还有一些以前没有注意到的东西比如栅格化 和 表格行列。 收获: 学习Boostrap的确如介绍所说加快了前端的效率,就拿导航栏 navigation 来说  原本写个导航栏 必须从头写起,从HTML的布局还要考虑到他的css样式 有些时候还会出现

Markuces的博客 1461

基于非接触式微波雷达设计的跌倒检测预警系统【短信报警】

本项目选择基于非接触式微波雷达的跌倒检测预警装置作为技术核心,采用云帆瑞达的R60AFD1跌倒检测模组。这一模组能够根据人体的运动变化,如速度、距离和姿态等特征,判断是否发生跌倒,并可以持续监控老年人是否处于危险状态。此外,本项目还结合4G通信技术,通过Air724UG模块实现短信报警功能,一旦检测到跌倒事故,系统将自动通过4G网络向紧急联系人发送短信报警,及时通知亲属或医护人员进行救援。

1761

23种Bootstrap导航菜单布局:打造极致用户体验的利器

23种Bootstrap导航菜单布局:打造极致用户体验的利器 去发现同类优质开源项目:https://gitcode.com/ 项目介绍 在现代网页设计中,导航菜单不仅是用户浏览网站的指南,更是提升用户体验的关键元素。为了满足各种复杂的导航需求,我们推出了这款基于Bootstrap的导航菜单布局设计jQuery插件。该插件集成了23种不同的导航菜单效果,包括下拉菜单、大型菜单、侧边栏菜单、购物车菜...

gitblog_09705的博客 1013

手把手保姆级|Python爬取微信公众号文章完整版,反反爬策略拉满,附可运行完整代码(永久可用)

做Python爬虫的朋友都知道,爬取微信公众号文章 绝对是爬虫领域的「香饽饽」也是「硬骨头」。一方面,微信公众号的文章是极具价值的数据源:不管是自媒体从业者做竞品分析、新媒体运营者整理干货、还是个人学习收集资料,都需要批量爬取公众号文章;另一方面,微信的反爬机制堪称全网最严苛之一 ——腾讯对微信生态的风控做到了极致,动态渲染页面、高频IP封禁、Cookie短时效失效、请求头严格校验、自动化工具秒识别、频繁请求直接拉黑,这些反爬手段让90%的爬虫新手望而却步:要么爬了几篇就被封IP,要么Cookie失效爬取中

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 2639

使用 Simulink Real-Time 搭建一个完整的实时信号采集与滤波系统模型

本文详细介绍了基于Simulink Real-Time构建实时信号采集与滤波系统的完整流程。主要内容包括:系统配置(模型创建与参数设置)、信号采集模块搭建(模拟信号源或真实硬件连接)、实时滤波器设计(浮点/定点)、输出可视化(Scope/ToWorkspace等)、模型编译与下载到目标机、外部模式在线调试及数据保存方法。系统可实现微秒级实时信号处理,适用于工业控制、航空航天等对时间确定性要求高的场景。文章还提供了优化建议(多速率建模、优先级调度等)和应用场景说明,帮助读者快速掌握实时系统开发的核心技能。

amy_mhd的博客 309

23种Bootstrap导航菜单布局

23种Bootstrap导航菜单布局 去发现同类优质开源项目:https://gitcode.com/ 资源描述 本仓库提供了一款基于Bootstrap的导航菜单布局设计jQuery插件。该插件集成了23种Bootstrap导航菜单效果,包括下拉菜单、大型菜单、侧边栏菜单、购物车菜单等,能够满足大部分网页导航菜单设计的需求。 功能特点 多样化的布局选择:提供了23种不同的导航菜单布局,涵盖了各种...

gitblog_09765的博客 478

游戏大厂如何解析引擎技术

本文系统解析了游戏大厂如何评估和定制游戏引擎。游戏引擎作为游戏开发的核心基础,大厂会从性能、跨平台支持、渲染能力、网络模块等8个维度进行技术解析,通过文档查勘、源码阅读、Demo测试等7个步骤深度评估。解析后通常有三种决策:直接使用、深度定制或自研重构。文章以腾讯、网易、米哈游等为例,展示了不同厂商的引擎定制策略,并分析了技术解析面临的挑战和未来趋势。最终指出,体系化的引擎技术解析是打造高质量游戏的关键,需要持续的技术投入和团队协作。

本博客聚焦游戏开发技巧、创业实战心得及大学热门课程干货。这里既有技术深度,也有思维广度,无论你是开发者、创业者还是高校学子,都能在这里找到适合自己的成长之路! 537

Boostrap

Boostrap

thwr1881的博客 806

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

python bootstrap container宽度_使用Boostrap,左侧菜单栏固定宽度,右侧自适应宽度。...

1、方法one思路概要:创建CSS自定义工具类,如ml-220p:margin-left:220px;使用JS绑定元素,控制相应元素增加和删除自定义的CSS工具类,达到预期视觉效果。不足之处是不够极客,完全可以用CSS控制的样式,需要JS来操作,多了一道手续,略显繁琐。HTML部分:收缩按钮头部这里是一个图标图标12312312312312312CSS部分:#home_header{height:...

weixin_39628945的博客 258

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

boostrap

bootstrap 想要了解详情可以去bootstrap中文网(https://www.bootcss.com/)或者是bootstrap官网(https://getbootstrap.com/docs/3.4/css/), 下拉列表 <div class="dropdown"> <button class="btn btn-default dropdown-toggle" ...

dudukawa的博客 278

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

用HTML,css,boostrap写一个综合大型购物网站

用HTML,css,boostrap写一个综合大型购物网站 首先来看看页面的效果: 有需要的可以参考 首先是首页index: <!DOCTYPE html> <html> <head> <!-- 先把bootstrap里面的css、jQuery和bootstrap.js三个文件按顺序加载进来 --> <meta charset="utf-8"> <title>Mrsjiang</title>

Mr_jianghanlin的博客 4637

7-boostrap笔记-下拉菜单

除了使用select标签创建一个人下拉菜单,还可以使用一个按钮加ul标签的形式创建一个下拉菜单,效果比select标签更加可观 <div class="dropdown"> <div class="btn-group"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dro

qq_25956141的博客 345

boostrap selectpicker 用法

.selectpicker('val') 您可以通过调用val元素上的方法来设置所选值。 1 2 $('.selectpicker').selectpicker('val','Mustard'); $('.selectpicker').selectpicker('val', ['Mustard','Relish']);  这不同于va...

wxban的博客 368

Boostrap nav和navbar的详细使用

bootstrap之navbar container:固定960px宽度,(如果又引入了响应式样式,则会适当调整,例如1600*900,它会显示1200px) container-fluid:自适应屏幕宽度,即满屏显示。 row和col可以参考一下:https://blog.csdn.net/yzy85/article/details/53021385?locationNum...

weixin_46724638的博客 5503

python bootstrap container宽度_使用Boostrap V4,左侧菜单栏可缩进,并根据屏幕宽度自适应大小。...

这个记录算是这段时间的一个总结吧。折腾了页面样式果然让人反复纠结。思路概要:使用.body-small,代表屏幕处于小分辨率下。用JQ的resize()方法监听。并在处增加或删除。使用.mini-sidebar,代表侧边栏处于收缩状态下。( .body-small 和 .mini-sidebar同时存在时,代表小分辨率下菜单收缩)开始干活,根据标签的class类,编写每个状态下对应的CSS样式。H...

weixin_35687571的博客 410
上一篇: springboot- Mybatis访问数据库use表
下一篇: springboot之 pagehelper+bootstrap-table插件
鲸鱼姐
博客等级 码龄15年 329粉丝 92原创
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址