English 中文(简体)
启动陷阱滚动Spy 似乎正在打破启动陷阱标签
原标题:Bootstrap ScrollSpy seems to be breaking Bootstrap tabs

我一直在尝试在使用标签的页面上执行滚动Spy。

这是我的身体标记:

<body data-spy="scroll" data-target=".subnav" data-offset="50">

这是我的标签 HTML:

<div class="div-tabs tabbable">
    <ul class="nav nav-tabs" id="myTab">
        <li class="active"><a href="" data-toggle="tab" data-target="#home">Home</a></li>
        <li><a href="" data-toggle="tab" data-target="#profile">Profile</a></li>
    </ul>
    <div id="myTabContent" class="tab-content">
        <div class="tab-pane active" id="home">
            <div class="padding16">
                   ...
            </div>
            <div class="button-bar">
                <a href="#" class="btn"><i class="icon-user"></i>Button</a> <a href="#" class="btn btn-primary">
                    <i class="icon-time icon-white"></i>Button</a> <a href="#" class="btn btn-warning">Button</a>
                <a href="#" class="btn btn-danger">Button</a> <a href="#" class="btn btn-success">Button</a>
            </div>
        </div>
        <div class="tab-pane " id="profile">
            <div class="padding16">
               ...
            </div>
            <div class="button-bar">
               <a href="#" class="btn btn-warning">Button</a>
                <a href="#" class="btn btn-danger">Button</a> <a href="#" class="btn btn-success">Button</a>
            </div>
        </div>
    </div>
</div>

如果我从标签中删除了 data- spy=" scroll" 数据目标=""subnav" 数据-offsetset="50" , 我的制表符工作正常。 如果启用了滚动, 我就会在 Chrome dev 工具中发现这个错误 :

类型错误: 无法读取 null 的属性顶部

有任何想法会有什么问题吗? 看起来ScrollSpy 正在导致布茨布设标签找不到 HREF 属性的引用 。

我使用靴杆2.0.2。

最佳回答

当我在导航中连接到标记中不存在的锚时,我看到了这个错误。例如,如果在导航中链接到 ,但页面上不存在有 id= 'about> 的元素,你会看到这个错误。

问题回答

暂无回答




相关问题
How to import Bootstrap JS with HTML5 reusable web components

RESOLVED: see my solution in a comment TL;DR: Can t get bootstrap s JS to trigger, suspect that I m importing the JS scripts wrong I ve been trying to get Bootstrap to work properly with my custom ...

Bootstrap scrollable table with fixed header

I want to create a table with a lot of data. To keep it all sorted out, I want the table to be scrollable. I use bootstrap to pimp up the table. I know this question is asked before and the solution ...

What is a CSS framework?

Can anyone tell me about CSS frameworks, and how to use them?

模块boot如何为违约模块工作?

我用两个单元确定我的申请,一个单元是关于阿明的,另一个单元是所谓的缺省。 然后,我为阿明模块创建了一个诱杀装置档案,当我试图确定......时。

热门标签