html - Bootstrap 3.0.3 词缀 - 内容不在固定位置并移动到其他内容之上

标签 html css twitter-bootstrap twitter-bootstrap-3

我有一个使用 Bootstrap 3.0.3 构建的遗留应用程序。在这种情况下,我们无法更新 Bootstrap。

也就是说,我正在尝试使用 3.0.3 来使用词缀功能。

我在 jsfiddle 上设置了以下内容:https://jsfiddle.net/x8fc9opm/8/

我想做的是在 .col-md-8(红色边框)左侧区域有一个 .col-md-4 元素“库” (蓝色边框)在右边。

左侧区域可能会变得很长,我希望蓝色区域始终可见,即使用户向下滚动也是如此。

所以我在 .col-md-4 中添加了以下内容:

<div class="col-md-4 tag-container" data-spy="affix" data-offset-top="60" data-offset-bottom="200">

enter image description here

当我运行它时,affix 向左移动并与红色区域重叠!

enter image description here

这是为什么?我认为词缀是为了固定内容而设计的。

我在这里做错了什么?

最佳答案

在您的 fiddle 中,当打开控制台时,它会显示消息 Uncaught Error: Bootstrap requires jQuery。当它被添加到其他脚本之上时,词缀会按预期工作。

同时包裹需要保持固定的列。变化:

<div class="col-md-4 tag-container" data-spy="affix" data-offset-top="60" data-offset-bottom="200">
    ...
</div>

收件人:

<div class="col-md-4 tag-container">
  <div data-spy="affix" data-offset-top="60" data-offset-bottom="200">
    ...
  </div>
</div>

关于html - Bootstrap 3.0.3 词缀 - 内容不在固定位置并移动到其他内容之上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52182416/

相关文章:

javascript - 在任何网站上展示我的 CSS 演示

html - 使用css居中对齐文本

javascript - JQUERY:为什么向下滚动时我的导航栏不固定在顶部?

javascript - TypeError : m. easing[this.easing] is not a function 错误

css - 响应式更改 CSS 定位方法,仅针对一个轴?

html - 如何去除 Bootstrap 中选择框的圆 Angular ?

html - 想要使 Font Awesome 图标更薄

文本溢出容器时的 HTML/CSS 换行符

html - 选择 4 之后的每个偶数项

CSS 显示 :table for filling height. 在 Chrome/Safari 与 Firefox/Opera 中不同