Force Bootstrap的折叠导航100%高度

时间:2016-12-08 19:15:09

标签: css twitter-bootstrap twitter-bootstrap-3

所以,我想将bootstrap的折叠导航高度设置为100%高度。

e.g。 https://getbootstrap.com/examples/navbar/这应该跨越整个屏幕。

我做了一些研究,大多数人发现人们使用height: 100vh;,但这不是动态,但最终不应该太重要,但我仍然不喜欢它。

通常,人们可以例如做:

<div id="bar">
  <div id="foo">
    test
  </div>
</div>

html, 
body {
    height: 100%;
}
#foo, #bar{
  background-color: red;
  min-height: 100%;
}

但我现在问自己,在使用bootstrap v3时,实现这一点的最佳方法是什么。

2 个答案:

答案 0 :(得分:0)

您可以在使用JavaScript折叠导航时隐藏内容。 例如:Socket

如果导航下没有内容,则无法滚动...:P

答案 1 :(得分:0)

  

所以我问自己,当导航崩溃时我怎么可以反复滚动?

     

我不知何故听不到正确的事件

根据你的评论,我发现问题在于你没有得到正确的崩溃点。该插件在$('#foo').on('hidden.bs.collapse', function () { // do something… }) 上提供事件。

通过bootstrap http://yaml-online-parser.appspot.com/ ,这就是你的工作方式

{
  "type" : "record",
  "name" : "Customer",
  "protocol": "xml",
  "fields" : [ {
    "name" : "Sender",
    "type" : {
      "type" : "record",
      "name" : "SenderInfo",
      "fields" : [ {
        "name" : "transmitDate",
        "type" : "long",
        "source" : "element transmitDate"
      }, {
        "name" : "transmitter",
        "type" : "string",
        "source" : "element transmitter"
      }, {
        "name" : "dealerCode",
        "type" : "string",
        "source" : "element dealerCode"
      }, {
        "name" : "territoryDealerCode",
        "type" : [ "null", "string" ],
        "source" : "element territoryDealerCode"
      }, {
        "name" : "DMSSystem",
        "type" : [ "null", "string" ],
        "source" : "element DMSSystem"
      }, {
        "name" : "DMSReleaseNumber",
        "type" : [ "null", "string" ],
        "source" : "element DMSReleaseNumber"
      } ]
    },
    "source" : "element Sender"
  }, {
    "name" : "Identifier",
    "type" : {
      "type" : "record",
      "name" : "Identifier",
      "fields" : [ {
        "name" : "updateInd",
        "type" : "string",
        "source" : "element updateInd"
      }, {
        "name" : "dealerCustNumber",
        "type" : "string",
        "source" : "element dealerCustNumber"
      }, {
        "name" : "dealerCustName",
        "type" : "string",
        "source" : "element dealerCustName"
      }, {
        "name" : "customerAlias",
        "type" : [ "null", "string" ],
        "source" : "element customerAlias"
      }, {
        "name" : "phoneNumber",
        "type" : [ "null", "string" ],
        "source" : "element phoneNumber"
      }, {
        "name" : "faxNumber",
        "type" : [ "null", "string" ],
        "source" : "element faxNumber"
      }, {
        "name" : "email",
        "type" : [ "null", "string" ],
        "source" : "element email"
      }, {
        "name" : "customerType",
        "type" : "string",
        "source" : "element customerType"
      }, {
        "name" : "activeCustomerInd",
        "type" : "boolean",
        "source" : "element activeCustomerInd"
      }, {
        "name" : "parentCustomerNumber",
        "type" : [ "null", "string" ],
        "source" : "element parentCustomerNumber"
      }, {
        "name" : "primaryStoreNumber",
        "type" : [ "null", "string" ],
        "source" : "element primaryStoreNumber"
      }, {
        "name" : "keyCatAccount",
        "type" : [ "null", "string" ],
        "source" : "element keyCatAccount"
      }, {
        "name" : "secondLevelDealerCode",
        "type" : [ "null", "string" ],
        "source" : "element secondLevelDealerCode"
      }, {
        "name" : "preferredLanguage",
        "type" : [ "null", "string" ],
        "source" : "element preferredLanguage"
      }, {
        "name" : "dealerDateInSystem",
        "type" : "long",
        "source" : "element dealerDateInSystem"
      }, {
        "name" : "dealerLastUpdatedDate",
        "type" : "long",
        "source" : "element dealerLastUpdatedDate"
      }, {
        "name" : "hdrChrgCode1",
        "type" : [ "null", "string" ],
        "source" : "element hdrChrgCode1"
      }, {
        "name" : "hdrChrgCode2",
        "type" : [ "null", "string" ],
        "source" : "element hdrChrgCode2"
      }, {
        "name" : "dealerCurrencyCode",
        "type" : [ "null", "string" ],
        "source" : "element dealerCurrencyCode"
      }, {
        "name" : "custCurrencyCode",
        "type" : [ "null", "string" ],
        "source" : "element custCurrencyCode"
      }, {
        "name" : "partsCustClass",
        "type" : [ "null", "string" ],
        "source" : "element partsCustClass"
      }, {
        "name" : "laborCustClass",
        "type" : [ "null", "string" ],
        "source" : "element laborCustClass"
      }, {
        "name" : "miscCustClass",
        "type" : [ "null", "string" ],
        "source" : "element miscCustClass"
      }, {
        "name" : "corpAccPartsPurchase",
        "type" : [ "null", "string" ],
        "source" : "element corpAccPartsPurchase"
      }, {
        "name" : "invoiceTypeInd",
        "type" : [ "null", "string" ],
        "source" : "element invoiceTypeInd"
      } ]
    },
    "source" : "element Identifier"
  }, {
    "name" : "Location",
    "type" : {
      "type" : "array",
      "items" : {
        "type" : "record",
        "name" : "Location",
        "fields" : [ {
          "name" : "address1",
          "type" : [ "null", "string" ],
          "source" : "element address1"
        }, {
          "name" : "address2",
          "type" : [ "null", "string" ],
          "source" : "element address2"
        }, {
          "name" : "address3",
          "type" : [ "null", "string" ],
          "source" : "element address3"
        }, {
          "name" : "city",
          "type" : [ "null", "string" ],
          "source" : "element city"
        }, {
          "name" : "postalCode",
          "type" : [ "null", "string" ],
          "source" : "element postalCode"
        }, {
          "name" : "county",
          "type" : [ "null", "string" ],
          "source" : "element county"
        }, {
          "name" : "state",
          "type" : [ "null", "string" ],
          "source" : "element state"
        }, {
          "name" : "country",
          "type" : [ "null", "string" ],
          "source" : "element country"
        }, {
          "name" : "location",
          "type" : [ "null", "string" ],
          "source" : "element location"
        }, {
          "name" : "addressType",
          "type" : "string",
          "source" : "element addressType"
        } ]
      }
    },
    "source" : "element Location"
  }, {
    "name" : "Contact",
    "type" : {
      "type" : "array",
      "items" : {
        "type" : "record",
        "name" : "Contact",
        "fields" : [ {
          "name" : "name",
          "type" : [ "null", "string" ],
          "source" : "element name"
        }, {
          "name" : "email",
          "type" : [ "null", "string" ],
          "source" : "element email"
        }, {
          "name" : "phone",
          "type" : [ "null", "string" ],
          "source" : "element phone"
        }, {
          "name" : "title",
          "type" : [ "null", "string" ],
          "source" : "element title"
        }, {
          "name" : "responsibility",
          "type" : [ "null", "string" ],
          "source" : "element responsibility"
        }, {
          "name" : "type",
          "type" : "string",
          "source" : "element type"
        }, {
          "name" : "phone2",
          "type" : [ "null", "string" ],
          "source" : "element phone2"
        }, {
          "name" : "preferredContact",
          "type" : [ "null", "string" ],
          "source" : "element preferredContact"
        } ]
      }
    },
    "source" : "element Contact"
  }, {
    "name" : "Division",
    "type" : {
      "type" : "array",
      "items" : {
        "type" : "record",
        "name" : "Division",
        "fields" : [ {
          "name" : "divisionCode",
          "type" : "string",
          "source" : "element divisionCode"
        }, {
          "name" : "divisionName",
          "type" : "string",
          "source" : "element divisionName"
        }, {
          "name" : "primaryDivisionCodeInd",
          "type" : [ "null", "boolean" ],
          "source" : "element primaryDivisionCodeInd"
        }, {
          "name" : "IndustryCode",
          "type" : {
            "type" : "array",
            "items" : {
              "type" : "record",
              "name" : "IndustryCode",
              "fields" : [ {
                "name" : "industryCode",
                "type" : "string",
                "source" : "element industryCode"
              }, {
                "name" : "primaryIndustryCodeInd",
                "type" : "boolean",
                "source" : "element primaryIndustryCodeInd"
              } ]
            }
          },
          "source" : "element IndustryCode"
        }, {
          "name" : "CustomerPreference",
          "type" : {
            "type" : "array",
            "items" : {
              "type" : "record",
              "name" : "CustomerPreference",
              "fields" : [ {
                "name" : "description",
                "type" : "string",
                "source" : "element description"
              }, {
                "name" : "value",
                "type" : "string",
                "source" : "element value"
              } ]
            }
          },
          "source" : "element CustomerPreference"
        }, {
          "name" : "SalesRep",
          "type" : {
            "type" : "array",
            "items" : {
              "type" : "record",
              "name" : "SalesRep",
              "fields" : [ {
                "name" : "number",
                "type" : "string",
                "source" : "element number"
              }, {
                "name" : "name",
                "type" : "string",
                "source" : "element name"
              }, {
                "name" : "type",
                "type" : "string",
                "source" : "element type"
              }, {
                "name" : "par",
                "type" : [ "null", "string" ],
                "source" : "element par"
              }, {
                "name" : "email",
                "type" : [ "null", "string" ],
                "source" : "element email"
              }, {
                "name" : "phoneNumber",
                "type" : [ "null", "string" ],
                "source" : "element phoneNumber"
              } ]
            }
          },
          "source" : "element SalesRep"
        } ]
      }
    },
    "source" : "element Division"
  }, {
    "name" : "ApplicationExtension",
    "type" : {
      "type" : "array",
      "items" : {
        "type" : "record",
        "name" : "ApplicationExtension",
        "fields" : [ {
          "name" : "applicationId",
          "type" : "string",
          "source" : "element applicationId"
        }, {
          "name" : "field",
          "type" : "string",
          "source" : "element field"
        }, {
          "name" : "value",
          "type" : "string",
          "source" : "element value"
        } ]
      }
    },
    "source" : "element ApplicationExtension"
  } ]
}