twitter-bootstrap – Google Prestify with Bootstrap:Line Numbers Not Showing

前端之家收集整理的这篇文章主要介绍了twitter-bootstrap – Google Prestify with Bootstrap:Line Numbers Not Showing前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用Google Prettify与Twitter Bootstrap.它正在工作,但由于某些原因,行号不显示.

这是标记

<pre class="prettyprint linenums">
    <ol class="linenums">
        <li class="L0">
            <span class="kwd">public</span>
            <span class="pln"> </span>
            <span class="kwd">override</span>
            <span class="pln"> </span>
            <span class="kwd">void</span>
            <span class="pln"> </span>
            <span class="typ">Dispose</span>
            <span class="pun">()</span>
        </li>
        <li class="L1">
            <span class="pln"> </span>
            <span class="pun">{</span>
        </li>
        <li class="L2">
            <span class="pln"> </span>
            <span class="kwd">base</span>
            <span class="pun">.</span>
            <span class="typ">Dispose</span>
            <span class="pun">();</span>
        </li>
            <li class="L3">
            <span class="pln"> </span>
            <span class="pun">}</span>
        </li>
    </ol>
</pre>

我称之为:

<script type="text/javascript">
    $(document).ready(function () {
        prettyPrint();
    });
</script>

我没有任何自定义CSS ..只使用Bootstrap CSS ..

解决方法

我建议你使用这2个文件

http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css

http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.js

并将其添加到您的页脚中:

<script>
  !function ($) {
    $(function(){
      window.prettyPrint && prettyPrint()   
    })
  }(window.jQuery)
</script>

发现于application.js http://twitter.github.com/

原文链接:https://www.f2er.com/bootstrap/233753.html

猜你在找的Bootstrap相关文章