zoukankan      html  css  js  c++  java
  • bootstrap 固定底部导航自适应

    在使用bootstrap 底部导航的时候遇到了一个问题 —— 当我的内容超过一屏的时候,底部的部分内容会被固定的导航内容遮盖

    自己写了一个JS脚本,解决自适应的问题

    <nav class="navbar navbar-default navbar-fixed-bottom">
    <div class="container-fluid margin_bottom_5 margin_top_5 clear_padding text-center">
    <button class="btn btn-e4005a" type="button" style="padding: 6px 30px;">提交</button>
    </div>
    </nav>

    <script>

    $(function(){
    autoNav();
    });

    //解决底部自动导航的问题
    function autoNav(){
    //获取内容的高度
    var bodyHeight = $("body").height();
    //获取底部导航的高度
    var navHeight = $(".navbar").height();
    //获取显示屏的高度
    var iHeight = document.documentElement.clientHeight||document.body.clientHeight;
    //如果内容的高度大于(窗口的高度 - 导航的高度),z则需要添加一个div,设置其高度
    if(bodyHeight > (iHeight - navHeight)){
    $("body").append('<div style="height: '+navHeight+'px"></div>');
    }
    }

    </script>

  • 相关阅读:
    typescript泛型
    安卓手机IPhone抓包Https
    js里面for循环的++i与i++
    http请求头
    从浏览器地址栏输入url到页面呈现
    docker部署nodejs应用
    mac下使用MongoDB
    使用vue-cli3&vue ui图形化界面创建项目
    javascript中的call, apply(转载)
    跨域请求
  • 原文地址:https://www.cnblogs.com/zhaoyingjie/p/5961080.html
Copyright © 2011-2022 走看看