Bootstrap   发布时间:2022-04-18  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了twitter-bootstrap – 如何使用Bootstrap滚动间谍?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我不能得到滚动间谍工作正常与垂直导航。下面你可以找到我使用的代码。由于某种原因,只有“Two”被激活。

任何人都有什么错误的想法?

<html lang="en">
<head>
    <Meta charset="utf-8">
    <title>Twitter Bootstrap Scroll Spy Playground</title>
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
  </head>
  <body>
    <div class="container">
      <div class="row">
        <div class="span3">
            <ul class="navbar nav nav-list affix">
              <li class="active"><a href="#one">One</a></li>
              <li><a href="#two">Two</a></li>
            </ul>
        </div>
        <div class="span1" data-spy="scroll">
            <section id="one">
            <h1>One</h1>
            <h2>Ad leggings keytar,brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. </h2>
            </section>
            <section id="two">
            <h1>Two</h1>
           <h2>Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Nihil tattooed accusamus,cred irony biodiesel keffiyeh artisan ullamco consequat.</h2>
            </section>   
        </div>
      </div>
    </div>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script src="bootstrap/js/bootstrap.js"></script>
</body>
</html>

解决方法

@H_489_9@ 在为自己排序这个问题,我发现被监视的元素需要有一个滚动条。

看看这个小提琴:http://jsfiddle.net/adamp/qgU6h/1/

你可以直接侦听body元素($(‘body’)。scrollspy())或者给你的内容一个明确的高度,并强制它显示一个滚动条。

(如果你看Bootstrap documentation example,它是固定高度的技巧。)

大佬总结

以上是大佬教程为你收集整理的twitter-bootstrap – 如何使用Bootstrap滚动间谍?全部内容,希望文章能够帮你解决twitter-bootstrap – 如何使用Bootstrap滚动间谍?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。