为什么Bootstrap的卷轴不起作用? [英] Why isn't Bootstrap's scrollspy working?

查看:119
本文介绍了为什么Bootstrap的卷轴不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的Bootstrap模态设置,在模态中我有一个 nav 和scrolllspy设置的内容。但是,它不起作用。我看到它被激活,但导航永远不会更新。

I have a simple Bootstrap modal setup, and in the modal I have content with a nav and scrollspy set up. However, it isn't working. I see it gets activated, but the nav is never updated.

完整的源代码太长了,你无法看到我得到的效果,所以我设置了 jsfiddle

The full source is too long for here and you wouldn't be able to see the effect I am getting, so I have set up a jsfiddle

我正在使用 data-spy =scroll方法来启用它。我做错了什么?为什么nav不会随你的位置更新?

I am using the data-spy="scroll" method to enable it. What have I done wrong? Why isn't the nav being update with your position?

推荐答案

嘿我认为这里有两个问题:

Hey I think there are two issues here:

(1)将scrollspy放在身体以外的其他东西上会导致问题。看看这个:

(1) putting scrollspy on something other than the body causes problem. Check out this:

在Twitter Bootstrap的ScrollSpy中,我可以在哪里放置数据-spy =" scroll"

如果你添加:

#area-to-watch {
    height: 200px;
    overflow: auto; 
}

它会让你滚动到间谍除了身体。
http://jsfiddle.net/hajpoj/SZYKM/
jsfiddle的修改版本

it will you allow you to scrollspy to "spy" on something other than the body. http://jsfiddle.net/hajpoj/SZYKM/ This a modified version of your jsfiddle

(2)将scrollspy放入模型会导致更多问题。如果你将上面的内容放入一个模型中,就会有点吓坏了。
我不是积极的但我认为你需要做类似的事情

(2) Putting scrollspy into a model causes more problems. If you put the above into a model, it kind of freaks out. I'm not positive but I think you need to do something like

.scrollspy('refresh')

在文档 http://twitter.github.com/bootstrap/javascript.html#scrollspy

这篇关于为什么Bootstrap的卷轴不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆