Question

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

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>

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.

How do I fix this?

Was it helpful?

Solution

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

disableHiddenCheck

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top