如何使Boostrap上col内的元素比col宽
How to make an element inside a col on Boostrap wider than the col?
对不起我的英语,我对Bootstrap有点问题。
我正试图让一个网站做出响应,我有一排4栏,如下所示:
div"seeMore"默认情况下是隐藏的,单击boxToggle元素时,它会显示带有slideToggle的块。这非常有效。
我的问题是,我希望div"seeMore"适合100%的行(就像col-lg-12)。
我试着把div"seeMore"放在col-lg-3之外,制作一个col-lg-12,它在大屏幕上运行良好,但在平板电脑和手机上坏了,因为div不在他的祖先名下。
$(document).ready(function() {
$("#boxToggle").click(function() {
$(".seeMore").slideToggle("slow");
});
});
@import url(https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css);
body {
font: arial sans-serif;
}
.wrapper {
width: 1280px;
margin: 0 auto;
}
.box {
background: pink;
color: #fff;
padding: 10px;
}
.box-body {
cursor: pointer;
height: 100px;
}
.seeMore {
display: none;
background: grey;
color: #fff;
padding: 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="row">
<div class="col-lg-3 col-md-8 col-sm-6 col-xs-12">
<div class="box box-int box-options">
<div class="box-header">
<h2>Title here</h2>
</div>
<div class="box-body" id="boxToggle">
<div class="layout no-padding">
<p>Some text here</p>
</div>
</div>
</div>
<div class="seeMore">
<div class="txt">
<h2>Some title here</h2>
<p>Blablabla</p>
</div>
</div>
</div>
</div>
如果你想看的话,我也做了一个codePen:http://codepen.io/puzzleland/pen/BKrVJe
感谢:)
我希望我能正确理解你想要实现的目标。如果您希望.seeMore
div适合整个行宽,您可以将列类声明从外部div移动到内部div,如下所示:
<div class="wrapper">
<div class="row">
<div> <!-- Delete the class from here and put the declaration inside .box and .seeMore -->
<div class="box box-int box-options col-lg-3 col-md-8 col-sm-6 col-xs-12">
<div class="box-header">
<h2>Title here</h2>
</div>
<div class="box-body" id="boxToggle">
<div class="layout no-padding">
<p>Some text here</p>
</div>
</div>
</div>
<div class="seeMore col-xs-12">
<div class="txt">
<h2>Some title here</h2>
<p>Blablabla</p>
</div>
</div>
</div>
</div>
</div>
相关文章:
- CKEditor Widget-阻止编辑可编辑元素本身
- 如何设置html元素填充的动画
- 如何将HTML id分配给元素,以及如何将JavaScript应用于元素
- 使用 jQuery 的 .on 函数如何获取事件的原始元素
- 使用clickToggle并在单击另一个元素时关闭元素
- 单击时将焦点更改为元素
- 表追加而不附加最后一个元素
- 如何在jQuery中获取元素的形式
- 我可以获得相对于被点击元素的确切点击位置吗
- 在函数中添加数组元素的数值
- 在单击任何位置时隐藏元素,而不检查每次DOM单击
- 将视口底部滚动到元素底部
- 是否有任何snippet或jQuery插件可以列出easylist.txt模式匹配的DOM中的所有元素
- 在不使用JQuery的情况下隐藏DOM中的选定元素
- 如何使用jquery处理php循环通过元素
- Ckeditor-plugin:插入虚假元素add不情愿<p>标签前后
- JQuery添加元素需要在我的js之前再次添加JQuery脚本
- 如何使Boostrap上col内的元素比col宽
- 有没有一种方法可以根据Angular中元素的数量来更改col-md类
- 如何在包含col元素的主体中选择tr