使用引导程序和使用选项卡时,迷你图未绘制 [英] Sparklines not drawing when using bootstrap and using tabs

查看:73
本文介绍了使用引导程序和使用选项卡时,迷你图未绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用bootstrap和jQuery Sparklines从
获得了一个RubyOnRails应用程序(3.2.x) http://omnipotent.net/jquery.sparkline/#s-about

I got a RubyOnRails application (3.2.x) using bootstrap and jQuery Sparklines from http://omnipotent.net/jquery.sparkline/#s-about

我的页面有两个使用bootstraps的标签,如下所示:

My page has 2 tabs using bootstraps and looks as follows:

<%=javascript_include_tag "utilities/sparkline.js" %>

<script type="text/javascript">$(function() {$('.inlinesparkline').sparkline('html', {type: 'line', height: '20px', width: '100px'});});</script>

<ul class="nav nav-tabs" id="myTab">
    <li><a href="#tab1" data-toggle="pill">Tab1</a></li>
    <li class="active"><a href="#tab2" data-toggle="pill">Tab2</a></li>
</ul>

<div class="tab-content">
    <div class="tab-pane well" id="tab1">
        <span class="inlinesparkline">1,2,3,4,5,6,7,6,5,4,3,4,5,6,7,8,7,6,4</span>
    </div>
    <div class="tab-pane well active" id="tab2">
        Hi there
    </div>
</div>

如果第二个标签是活动标签,那么切换到第一个标签时显示的数字不是迷你图但如果我将标签1设为活动标签,则会绘制迷你图。

If the second tab is the active tab then when switching to the first tab shows the numbers not the sparkline but if I make tab 1 the active tab then the sparkline is drawn.

如何解决此问题?

推荐答案

我终于修复了它,有一个参数可以作为选项添加:

I finally fixed it, there is a parameter that you can add as an option:

disableHiddenCheck

必须将其设置为true,因此适用于:

had to set it to true, so this works with:

<script type="text/javascript">$(function() {$('.inlinesparkline').sparkline('html', {type: 'line', disableHiddenCheck: true, height: '20px', width: '100px'});});</script>

这篇关于使用引导程序和使用选项卡时,迷你图未绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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