Javascript div调整bootsrap大小时更改窗体布局
我想在加载页面时水平显示一个表单,如下所示:当div被放大时,它应该像这样更改显示样式。页面使用引导内置类调整大小为am,但当浏览器调整大小时为oly。我想在调整div大小时在上实现这一点Javascript div调整bootsrap大小时更改窗体布局,javascript,jquery,html,twitter-bootstrap,twitter-bootstrap-3,Javascript,Jquery,Html,Twitter Bootstrap,Twitter Bootstrap 3,我想在加载页面时水平显示一个表单,如下所示:当div被放大时,它应该像这样更改显示样式。页面使用引导内置类调整大小为am,但当浏览器调整大小时为oly。我想在调整div大小时在上实现这一点 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script s
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
body, html {
height: 100%;
overflow: hidden;
}
#wrapper {
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 850px;
height: 100%;
margin-left: -250px;
overflow-y: auto;
overflow-x: hidden;
background: #DB1849;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
#top{
margin-top: 16px;
}
</style>
<script>
$(document).ready(function(){
$("#sidebar-wrapper").load("page.html");
$("#sidebar-wrapper").click(function (e) {
e.preventDefault();
$("#sidebar-wrapper").css("width","250");
});
});
</script>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
</body>
</html>
<form class="form-horizontal">
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4">FirstName</label>
<div class="col-sm-8">
<input type="text" class="form-control" >
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">LastName</label>
<div class="col-sm-8">
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Email</label>
<div class="col-sm-8">
<input type="email" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Passowrd</label>
<div class="col-sm-8">
<input type="password" class="form-control">
</div>
</div>
</div>
</form>
</div>
以下是我迄今为止所做的工作
在此处插入标题
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
body, html {
height: 100%;
overflow: hidden;
}
#wrapper {
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 850px;
height: 100%;
margin-left: -250px;
overflow-y: auto;
overflow-x: hidden;
background: #DB1849;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
#top{
margin-top: 16px;
}
</style>
<script>
$(document).ready(function(){
$("#sidebar-wrapper").load("page.html");
$("#sidebar-wrapper").click(function (e) {
e.preventDefault();
$("#sidebar-wrapper").css("width","250");
});
});
</script>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
</body>
</html>
<form class="form-horizontal">
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4">FirstName</label>
<div class="col-sm-8">
<input type="text" class="form-control" >
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">LastName</label>
<div class="col-sm-8">
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Email</label>
<div class="col-sm-8">
<input type="email" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Passowrd</label>
<div class="col-sm-8">
<input type="password" class="form-control">
</div>
</div>
</div>
</form>
</div>
正文,html{
身高:100%;
溢出:隐藏;
}
#包装纸{
左侧填充:0;
-webkit过渡:所有0.5s轻松;
-moz过渡:所有0.5s轻松;
-o型过渡:所有0.5s的轻松度;
过渡:所有0.5s缓解;
}
#边栏包装{
z指数:1000;
位置:固定;
左:250px;
宽度:850px;
身高:100%;
左边距:-250px;
溢出y:自动;
溢出x:隐藏;
背景:#DB1849;
-webkit过渡:所有0.5s轻松;
-moz过渡:所有0.5s轻松;
-o型过渡:所有0.5s的轻松度;
过渡:所有0.5s缓解;
}
#页面内容包装器{
宽度:100%;
位置:绝对位置;
填充:15px;
}
#顶{
边缘顶部:16px;
}
$(文档).ready(函数(){
$(“#侧栏包装器”).load(“page.html”);
$(“#边栏包装”)。单击(函数(e){
e、 预防默认值();
$(“#边栏包装”).css(“宽度”,“250”);
});
});
这是包含表单的页面。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
body, html {
height: 100%;
overflow: hidden;
}
#wrapper {
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 850px;
height: 100%;
margin-left: -250px;
overflow-y: auto;
overflow-x: hidden;
background: #DB1849;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
#top{
margin-top: 16px;
}
</style>
<script>
$(document).ready(function(){
$("#sidebar-wrapper").load("page.html");
$("#sidebar-wrapper").click(function (e) {
e.preventDefault();
$("#sidebar-wrapper").css("width","250");
});
});
</script>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
</body>
</html>
<form class="form-horizontal">
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4">FirstName</label>
<div class="col-sm-8">
<input type="text" class="form-control" >
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">LastName</label>
<div class="col-sm-8">
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Email</label>
<div class="col-sm-8">
<input type="email" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Passowrd</label>
<div class="col-sm-8">
<input type="password" class="form-control">
</div>
</div>
</div>
</form>
</div>
名字
姓氏
电子邮件
帕索德
在使用col-md-4的地方添加更多类:
col-md-4 col-lg-2 col-sm-12 col-xs-12在使用col-md-4的地方添加更多类:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
body, html {
height: 100%;
overflow: hidden;
}
#wrapper {
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 850px;
height: 100%;
margin-left: -250px;
overflow-y: auto;
overflow-x: hidden;
background: #DB1849;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
#top{
margin-top: 16px;
}
</style>
<script>
$(document).ready(function(){
$("#sidebar-wrapper").load("page.html");
$("#sidebar-wrapper").click(function (e) {
e.preventDefault();
$("#sidebar-wrapper").css("width","250");
});
});
</script>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
</body>
</html>
<form class="form-horizontal">
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4">FirstName</label>
<div class="col-sm-8">
<input type="text" class="form-control" >
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">LastName</label>
<div class="col-sm-8">
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Email</label>
<div class="col-sm-8">
<input type="email" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Passowrd</label>
<div class="col-sm-8">
<input type="password" class="form-control">
</div>
</div>
</div>
</form>
</div>
col-md-4 col-lg-2 col-sm-12 col-xs-12检查网格是如何工作的,检查网格是如何工作的,
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
body, html {
height: 100%;
overflow: hidden;
}
#wrapper {
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 850px;
height: 100%;
margin-left: -250px;
overflow-y: auto;
overflow-x: hidden;
background: #DB1849;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
#top{
margin-top: 16px;
}
</style>
<script>
$(document).ready(function(){
$("#sidebar-wrapper").load("page.html");
$("#sidebar-wrapper").click(function (e) {
e.preventDefault();
$("#sidebar-wrapper").css("width","250");
});
});
</script>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
</body>
</html>
<form class="form-horizontal">
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4">FirstName</label>
<div class="col-sm-8">
<input type="text" class="form-control" >
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">LastName</label>
<div class="col-sm-8">
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Email</label>
<div class="col-sm-8">
<input type="email" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="pwd">Passowrd</label>
<div class="col-sm-8">
<input type="password" class="form-control">
</div>
</div>
</div>
</form>
</div>