admin管理员组文章数量:1425717
I have been playing with a preview of Bootstrap 3, and have had troubles with the "affix pluggin", which allows for fixed-position floating bars.
Please find a fiddle here showing my troubles. Basically, the right-hand side button does float, but the width and offset styling inherited from the grid system seems to disappear when position: fixed
is applied.
This is my code:
<div class='container'>
<div class='row'>
<div class='col-span-8'>
<legend>Lorem</legend>
<div>[Large amounts of text]</div>
</div>
<div class='col-span-4 well' data-spy='affix' data-offset-top='50'>
<div class='btn btn-large btn-danger col-span-12'>This is fixed</div>
</div>
</div>
</div>
What am I doing wrong? (I know Bootstrap 3 is still under active development, but I hope someone with have some insight here.)
I have been playing with a preview of Bootstrap 3, and have had troubles with the "affix pluggin", which allows for fixed-position floating bars.
Please find a fiddle here showing my troubles. Basically, the right-hand side button does float, but the width and offset styling inherited from the grid system seems to disappear when position: fixed
is applied.
This is my code:
<div class='container'>
<div class='row'>
<div class='col-span-8'>
<legend>Lorem</legend>
<div>[Large amounts of text]</div>
</div>
<div class='col-span-4 well' data-spy='affix' data-offset-top='50'>
<div class='btn btn-large btn-danger col-span-12'>This is fixed</div>
</div>
</div>
</div>
What am I doing wrong? (I know Bootstrap 3 is still under active development, but I hope someone with have some insight here.)
Share Improve this question edited Aug 13, 2013 at 8:38 edsioufi 8,3453 gold badges38 silver badges42 bronze badges asked Apr 28, 2013 at 12:45 RandomblueRandomblue 117k150 gold badges363 silver badges558 bronze badges1 Answer
Reset to default 2data-offset-top='50'
adds the class affix-top
. This class has no definition in bootstrap.css. After scrolling the page the class affix
replace the class affix-top
. affix
defines the position fixed. This caused different displays of your affixed div.
Maybe Changing your code to shown below works more as expected. NB in this case The affixed div isn't shown on small screens?!
<div class='container'>
<div class='row'>
<div class='col-span-8'>
<legend>Lorem</legend>
<div>[Large amounts of text]</div>
</div>
<div class='col-span-4'>
<div class="well col-span-4" data-spy='affix'>
<div class='btn btn-large btn-danger col-span-12'>This is fixed</div>
</div>
</div>
</div>
</div>
本文标签: javascriptBootstrap 3 affixStack Overflow
版权声明:本文标题:javascript - Bootstrap 3 affix - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745400357a2657007.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论