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

Boostarp-响应式

时间:2017-10-20 21:39:21      阅读:347      评论:0      收藏:0      [点我收藏+]

标签:切换   ibus   target   screen   one   jquer   linear   duration   func   

一、响应式

 

 响应式介绍
- 响应式布局是什么?
同一个网页在不同的终端上呈现不同的布局等
- 响应式怎么实现的?
1. CSS3 media query 媒体查询
2. JS去控制网页的布局和样式等
- 缺点:工作量大,网页响应慢
- 优点: 专治疑难杂症
3. 用框架
- Bootstrap
- modal
- 轮播
技术分享
<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>轮播示例</title>
    <link rel="stylesheet" href="../bootstrap-3.3.7/css/bootstrap.min.css">
</head>
<body>
<!--<div class="container">-->
    <!--<div class="row">-->
        <!--<div class="col-md-12">-->
            <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                <!-- 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>
                </ol>

                <!-- Wrapper for slides -->
                <div class="carousel-inner" role="listbox">
                    <div class="item active">
                        <img src="img/banner_1.jpg" alt="...">
                        <div class="carousel-caption">
                            世情薄,人情恶,雨送黄昏花易落。
                        </div>
                    </div>
                    <div class="item">
                        <img src="img/banner_2.jpg" alt="...">
                        <div class="carousel-caption">
                            晓风干,泪痕残,欲笺心情,独语斜阑, 难 难 难。
                        </div>
                    </div>

                    <div class="item">
                        <img src="img/banner_3.jpg" alt="...">
                        <div class="carousel-caption">
                            人成各,今非昨。病魂常似秋千索。
                        </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>-->
    <!--</div>-->
<!--</div>-->

<script src="../jquery-3.2.1.js"></script>
<script src="../bootstrap-3.3.7/js/bootstrap.min.js"></script>

</body>
</html>
轮播示列
 二、自定义Bootstrap组件,
- 找到自定义那一页
- 勾选我用到的组件
- 拉到最后面,点击下载



三、常用插件

- Sweet Alert

- jQuery lazyload
- 懒加载图片
技术分享
<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>图标示例</title>
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="bootstrap-3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="toastr/toastr.min.css">
</head>
<body>

<button class="btn btn-lg btn-primary"><i class="fa fa-plug" aria-hidden="true"></i>微信</button>


<span class="fa-stack fa-lg">
  <i class="fa fa-circle-o fa-stack-1x"></i>
  <i class="fa fa-wechat fa-stack-2x"></i>
</span>

<script src="jquery-3.2.1.js"></script>
<script src="toastr/toastr.min.js"></script>

<script>
    toastr.options = {
        "closeButton": true,
        "debug": false,
        "progressBar": false,
        "positionClass": "toast-top-left",
        "onclick": null,
        "showDuration": "300",
        "hideDuration": "1000",
        "timeOut": "5000",
        "extendedTimeOut": "1000",
        "showEasing": "swing",
        "hideEasing": "linear",
        "showMethod": "fadeIn",
        "hideMethod": "fadeOut"
    };

    toastr.info("Flatlab is an Awesome dashboard build with BS3 ", "Toastr Notification")
</script>
</body>
</html>
懒加载图片
   - Font Awesome 
- 字体图标

- Toastr
- 通知栏的插件
技术分享
<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>图标示例</title>
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="bootstrap-3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="toastr/toastr.min.css">
</head>
<body>

<button class="btn btn-lg btn-primary"><i class="fa fa-plug" aria-hidden="true"></i>微信</button>


<span class="fa-stack fa-lg">
  <i class="fa fa-circle-o fa-stack-1x"></i>
  <i class="fa fa-wechat fa-stack-2x"></i>
</span>

<script src="jquery-3.2.1.js"></script>
<script src="toastr/toastr.min.js"></script>

<script>
    toastr.options = {
        "closeButton": true,
        "debug": false,
        "progressBar": false,
        "positionClass": "toast-top-left",
        "onclick": null,
        "showDuration": "300",
        "hideDuration": "1000",
        "timeOut": "5000",
        "extendedTimeOut": "1000",
        "showEasing": "swing",
        "hideEasing": "linear",
        "showMethod": "fadeIn",
        "hideMethod": "fadeOut"
    };

    toastr.info("Flatlab is an Awesome dashboard build with BS3 ", "Toastr Notification")
</script>
</body>
</html>
图片示列
   使用:
基本上都是基于jQuery
1. 先导入插件的CSS文件
2. 导入jQuery
3. 导入插件的JS文件

技术分享
## 常用jQuery插件

  - [Font Awesome](http://fontawesome.io/)
  - [jQuery lazy load](https://github.com/tuupola/jquery_lazyload)
  - [SweetAlert](https://github.com/t4t5/sweetalert)/[SweetAlert2](https://github.com/limonte/sweetalert2)
  - [Toastr](http://codeseven.github.io/toastr/)
常用jQuery插件

技术分享
<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">
    <title>offcanvas示例</title>
    <link rel="stylesheet" href="bootstrap-3.3.7/css/bootstrap.min.css">
    <style>
        body{
               overflow-x: hidden;
        }
        @media screen and (max-width: 760px) {
            #r1 {
                position: relative;
                right: 0;
                /*transition: all .25s ease-out;*/
            }

            #r1 .sidebar {
                right: -50%;
            }

            #r1.active {
                right: 50%;
            }

            .sidebar {
                position: absolute;
                width: 50%;
                top: 0;
            }
        }

    </style>
</head>
<body>
<nav class="navbar navbar-inverse">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <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="#">Brand</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
                <li><a href="#">Link</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">Dropdown <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">One more separated link</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<!-- 上面是导航条-->
<!-- 下面是页面主体-->
<div class="container">
    <div class="row" id="r1">
        <div class="col-md-9 col-sm-9 col-cs-9">
            <p class="visible-xs pull-right">
                <button class="btn btn-xs btn-primary" id="toggle-sidebar">切换</button>
            </p>
            <!-- 巨幕组件-->
            <div class="jumbotron">
                <h1>Hello, world!</h1>
                <p>This is a simple hero unit, a simple jumbotron-style component for calling extra attention to
                    featured content or information.</p>
                <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
            </div>

            <!--分块的内容 -->
            <div class="col-md-4 col-sm-6 col-xs-6">
                <h2>类好啊</h2>
                <p>Donec i|d elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor
                    mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna
                    mollis euismod. Donec sed odio dui.</p>
                <button class="btn btn-default">查看详情>></button>
            </div>
            <!--分块的内容 -->
            <div class="col-md-4 col-sm-6 col-xs-6">
                <h2>类好啊</h2>
                <p>Donec i|d elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor
                    mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna
                    mollis euismod. Donec sed odio dui.</p>
                <button class="btn btn-default">查看详情>></button>
            </div>
            <!--分块的内容 -->
            <div class="col-md-4 col-sm-6 col-xs-6">
                <h2>类好啊</h2>
                <p>Donec i|d elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor
                    mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna
                    mollis euismod. Donec sed odio dui.</p>
                <button class="btn btn-default">查看详情>></button>
            </div>
            <!--分块的内容 -->
            <div class="col-md-4 col-sm-6 col-xs-6">
                <h2>类好啊</h2>
                <p>Donec i|d elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor
                    mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna
                    mollis euismod. Donec sed odio dui.</p>
                <button class="btn btn-default">查看详情>></button>
            </div>
            <!--分块的内容 -->
            <div class="col-md-4 col-sm-6 col-xs-6">
                <h2>类好啊</h2>
                <p>Donec i|d elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor
                    mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna
                    mollis euismod. Donec sed odio dui.</p>
                <button class="btn btn-default">查看详情>></button>
            </div>
            <!--分块的内容 -->
            <div class="col-md-4 col-sm-6 col-xs-6">
                <h2>类好啊</h2>
                <p>Donec i|d elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor
                    mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna
                    mollis euismod. Donec sed odio dui.</p>
                <button class="btn btn-default">查看详情>></button>
            </div>
            <!--分块的内容 -->
            <div class="col-md-4 col-sm-6 col-xs-6">
                <h2>类好啊</h2>
                <p>Donec i|d elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor
                    mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna
                    mollis euismod. Donec sed odio dui.</p>
                <button class="btn btn-default">查看详情>></button>
            </div>
            <!--分块的内容 -->
            <div class="col-md-4 col-sm-6 col-xs-6">
                <h2>类好啊</h2>
                <p>Donec i|d elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor
                    mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna
                    mollis euismod. Donec sed odio dui.</p>
                <button class="btn btn-default">查看详情>></button>
            </div>
            <!--分块的内容 -->
            <div class="col-md-4 col-sm-6 col-xs-6">
                <h2>类好啊</h2>
                <p>Donec i|d elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor
                    mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna
                    mollis euismod. Donec sed odio dui.</p>
                <button class="btn btn-default">查看详情>></button>
            </div>
        </div>
        <div class="col-md-3 col-sm-3 col-xs-3 sidebar">
            <!-- 列表组 组件-->
            <ul class="list-group">
                <li class="list-group-item active">Cras justo odio</li>
                <li class="list-group-item">Dapibus ac facilisis in</li>
                <li class="list-group-item">Morbi leo risus</li>
                <li class="list-group-item">Porta ac consectetur ac</li>
                <li class="list-group-item">Vestibulum at eros</li>
            </ul>
        </div>
    </div>
</div>


<script src="jquery-3.2.1.js"></script>
<script src="bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
    $("#toggle-sidebar").click(function () {
      $("#r1").toggleClass("active");
    });
  });
</script>
</body>
</html>
offcanvas

 

 

 

Boostarp-响应式

标签:切换   ibus   target   screen   one   jquer   linear   duration   func   

原文地址:http://www.cnblogs.com/mengqingjian/p/7701267.html

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