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

【Bootstrap__实例】bootstrap 导航条、轮播图、三列布局、分割线、标签页、模态框、版权 等综合应用

时间:2020-06-28 00:40:05      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:轮播图   win   smi   otto   rand   UNC   panel   dism   false   

简介

1、轮播图切换时间间隔,鼠标悬停停止
2、文档定位$(document).scrollTop()

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>bootstrap实例</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
    <!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
    <style>
        img {
            width: 100%;
        }

        .k-navbar {
            margin-bottom: 0px;
        }

        .k-carousel {
            margin-top: 50px;
        }

        .k-carousel, .k-carousel .item {
            height: 500px;
            overflow: hidden;
        }

        .carousel-caption {
            bottom: 5%;
        }

        @media only screen and (max-width: 768px) {
            .carousel-caption {
                bottom: 5%;
            }

            .k-carousel, .k-carousel .item {
                height: 200px;
            }
        }

        .k-container {
            margin-top: 50px;
        }

        .k-container .thumbnail {
            border: 0px;
        }

        .thumbnail img {
            width: auto;
        }

        .k-hr {
            margin: 50px auto;
        }

        .k-hr hr {
            border: 1px solid lightgray;
        }

    </style>
</head>
<body>
<!--导航条-->
<nav class="navbar navbar-inverse k-navbar navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">现代浏览器博物馆</a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">综述 <span class="sr-only">(current)</span></a></li>
                <li><a href="#">简述</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">特点 <span class="caret"></span></a>
                    <ul class="dropdown-menu" id="k-drop-menu">
                        <li><a href="#Chrome">Chrome</a></li>
                        <li><a href="#Firefox">Firefox</a></li>
                        <li><a href="#Safari">Safari</a></li>
                        <li><a href="#Opera">Opera</a></li>
                        <li><a href="#IE">IE</a></li>
                    </ul>
                </li>
                <li><a href="javascript:;" data-toggle="modal" data-target="#myModal">关于</a></li>
            </ul>
        </div>
    </div>
</nav>
<!--轮播图-->
<div id="carousel-example-generic" class="k-carousel carousel slide" data-ride="carousel" data-interval="1000">
    <!-- Indicators -->
    <ol class="carousel-indicators">
        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
        <li data-target="#carousel-example-generic" data-slide-to="3"></li>
        <li data-target="#carousel-example-generic" data-slide-to="4"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
        <div class="item active">
            <img src="./img/chrome-big.jpg" alt="...">
            <div class="carousel-caption">
                <h2>chrome</h2>
            </div>
        </div>
        <div class="item">
            <img src="./img/firefox-big.jpg" alt="...">
            <div class="carousel-caption">
                <h2>firefox</h2>
            </div>
        </div>
        <div class="item">
            <img src="./img/safari-big.jpg" alt="...">
            <div class="carousel-caption">
                <h2>safari</h2>
            </div>
        </div>
        <div class="item">
            <img src="./img/opera-big.jpg" alt="...">
            <div class="carousel-caption">
                <h2>opera</h2>
            </div>
        </div>
        <div class="item">
            <img src="./img/ie-big.jpg" alt="...">
            <div class="carousel-caption">
                <h2>ie</h2>
            </div>
        </div>
    </div>

    <!-- Controls -->
    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
    </a>
</div>
<!--三列布局-->
<div class="container k-container">
    <div class="row">

        <div class="col-lg-4">
            <div class="thumbnail">
                <img src="img/chrome-logo-small.jpg" alt="...">
                <div class="caption text-center">
                    <h3>Chrome<br/></h3>
                    <p>Google Chrome,又称Google浏览器,是一个由Google(谷歌)公司开发的网页浏览器。</p>
                    <!--<button type="button" class="btn btn-default">点我下载</button>-->
                    <a href="#" class="btn btn-default">点我下载</a>
                </div>
            </div>
        </div>

        <div class="col-lg-4">
            <div class="thumbnail">
                <img src="img/firefox-logo-small.jpg" alt="...">
                <div class="caption text-center">
                    <h3>Firefox<br/></h3>
                    <p>Mozilla Firefox,中文名通常称为“火狐”或“火狐浏览器”,是一个开源网页浏览器。</p>
                    <button type="button" class="btn btn-default">点我下载</button>
                </div>
            </div>
        </div>

        <div class="col-lg-4">
            <div class="thumbnail">
                <img src="img/safari-logo-small.jpg" alt="...">
                <div class="caption text-center">
                    <h3>Safari<br/></h3>
                    <p>Safari,是苹果计算机的最新操作系统Mac OS X中的浏览器。</p>
                    <button type="button" class="btn btn-default">点我下载</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!--分割线-->
<div class="container k-hr">
    <hr/>
</div>
<!--标签页-->
<div class="container">
    <!-- Nav tabs -->
    <ul class="nav nav-tabs" role="tablist" id="k-list">
        <li role="presentation" class="active"><a href="#Chrome" aria-controls="Chrome" role="tab" data-toggle="tab">Chrome</a>
        </li>
        <li role="presentation"><a href="#Firefox" aria-controls="profile" role="tab" data-toggle="tab">Firefox</a></li>
        <li role="presentation"><a href="#Safari" aria-controls="messages" role="tab" data-toggle="tab">Safari</a>
        </li>
        <li role="presentation"><a href="#Opera" aria-controls="settings" role="tab" data-toggle="tab">Opera</a>
        </li>
        <li role="presentation"><a href="#IE" aria-controls="settings" role="tab" data-toggle="tab">IE</a>
        </li>
    </ul>
    <!-- Tab panes -->
    <div class="tab-content" id="k-content">
        <div role="tabpanel" class="tab-pane active" id="Chrome">
            <div class="row">
                <div class="col-md-7">
                    <h2>IE 你懂的</h2>
                    <span>Internet Explorer,原称Microsoft Internet Explorer(6版本以前)和Windows Internet Explorer(7,8,9,10版本),
                        简称IE,是美国微软公司推出的一款网页浏览器。它采用的排版引擎(俗称内核)为Trident。</span>
                </div>
                <div class="col-md-5">
                    <img src="img/chrome-logo.jpg" art="">
                </div>
            </div>
        </div>
        <div role="tabpanel" class="tab-pane" id="Firefox">
            <div class="row">
                <div class="col-md-5">
                    <img src="img/firefox-logo.jpg" art="">
                </div>
                <div class="col-md-7">
                    <h2>IE 你懂的</h2>
                    <span>Internet Explorer,原称Microsoft Internet Explorer(6版本以前)和Windows Internet Explorer(7,8,9,10版本),
                        简称IE,是美国微软公司推出的一款网页浏览器。它采用的排版引擎(俗称内核)为Trident。</span>
                </div>
            </div>
        </div>
        <div role="tabpanel" class="tab-pane" id="Safari">
            <div class="row">
                <div class="col-md-7">
                    <h2>IE 你懂的</h2>
                    <span>Internet Explorer,原称Microsoft Internet Explorer(6版本以前)和Windows Internet Explorer(7,8,9,10版本),
                        简称IE,是美国微软公司推出的一款网页浏览器。它采用的排版引擎(俗称内核)为Trident。</span>
                </div>
                <div class="col-md-5">
                    <img src="img/safari-logo.jpg" art="">
                </div>
            </div>
        </div>
        <div role="tabpanel" class="tab-pane" id="Opera">
            <div class="row">
                <div class="col-md-5">
                    <img src="img/opera-logo.jpg" art="">
                </div>
                <div class="col-md-7">
                    <h2>IE 你懂的</h2>
                    <span>Internet Explorer,原称Microsoft Internet Explorer(6版本以前)和Windows Internet Explorer(7,8,9,10版本),
                        简称IE,是美国微软公司推出的一款网页浏览器。它采用的排版引擎(俗称内核)为Trident。</span>
                </div>
            </div>
        </div>
        <div role="tabpanel" class="tab-pane" id="IE">
            <div class="row">
                <div class="col-md-7">
                    <h2>IE 你懂的</h2>
                    <span>Internet Explorer,原称Microsoft Internet Explorer(6版本以前)和Windows Internet Explorer(7,8,9,10版本),
                        简称IE,是美国微软公司推出的一款网页浏览器。它采用的排版引擎(俗称内核)为Trident。</span>
                </div>
                <div class="col-md-5">
                    <img src="img/ie-logo.jpg" art="">
                </div>
            </div>
        </div>
    </div>
</div>
<!--模态框-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">模态框</h4>
            </div>
            <div class="modal-body">
                我是一个模态框
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>
<!--版权-->
<div class="container">
    &copy;kikyo
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script>
    $(function () {
        //m1();
        Jump();
    })
    function m1() {
        $(‘.carousel‘).carousel({
            interval: 1000,//2s切图
            pause: null,//鼠标hover不暂停
            wrap: null//不循环
        })
    }
    function Jump() {
        $("#k-drop-menu li a").click(function (e) {
            e.preventDefault();
            var href = $(this).attr("href");
            var selector = "#k-list li a[href=‘" + href + "‘]";
            $(selector).tab(‘show‘);
            $(document).scrollTop($("#k-content").offset().top);
        });
    }
</script>
</body>
</html>

【Bootstrap__实例】bootstrap 导航条、轮播图、三列布局、分割线、标签页、模态框、版权 等综合应用

标签:轮播图   win   smi   otto   rand   UNC   panel   dism   false   

原文地址:https://www.cnblogs.com/kikyoqiang/p/13200596.html

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