我不能让sparklines.js解开我的火花。我在函数中包含了$.sparkline_display_visible()函数,我在函数中隐藏了div。官方文档非常简单:
来自http://omnipotent.net/jquery.sparkline/#hidden
解决方案是在火花线出现时调用$.sparkline_display_visible()函数,以便正确呈现。这是该站点用于处理隐藏在不同选项卡部分中的火花线的技术;该站点在选项卡更改的回调中调用例程。
<html>
<script src="/s/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="/s/js/jquery.sparkline.min.js"></script>
<body>
<button id="neighborhood_standards_button">Sort</button><br>
<div id="neighborhood_standards">
Q117 {{org}} listens and responds appropriately to our questions and concerns. <br><span style="font-size:small">
(5.4 vs 8.2)</span></td><td>
<div id="neigh_q117" style="display: inline-block;"></div>
</div>
<div id="smart_sort" style="display:none;">
Q117 {{org}} listens and responds appropriately to our questions and concerns. <br><span style="font-size:small">
(8.6 vs 8.2)</span>
<div id="smart_q117" style="display: inline-block;"></div>
</div>
<script type="text/javascript">
$("#smart_q117").sparkline([8.2,8.6,10,8,6],
{type: 'bullet',
rangeColors: ['#f189b1','#f4a0c0','#f9cede'],
targetWidth: 10,
targetColor: '#73913b',
performanceColor: '#c9413f',
width: '400px'
});
$("#neigh_q117").sparkline([8.2,5.4,10,8,6],
{type: 'bullet',
rangeColors: ['#f189b1','#f4a0c0','#f9cede'],
targetWidth: 10,
targetColor: '#73913b',
performanceColor: '#c9413f',
width: '400px'
});
$(document).ready(function(){
$("#neighborhood_standards_button").click(function(){
$("#smart_sort").toggle();
$("#neighborhood_standards").toggle();
$.sparkline_display_visible();
});
});
</script>
</body>
</html>所以,经过通常的脑震荡和重读之后,我问你们关于我错过了什么的建议。
发布于 2015-04-01 10:18:49
您必须在div中有一些东西,即将nbsp;插入空div中。
<div id="smart_q117" style="display: inline-block;"> </div> [see http://jsfiddle.net/WackyDad/utLsfyga/]另外,你似乎也有一些杂乱的标签(例如,关闭td,然后打开没有关闭的,也不在表中)。
https://stackoverflow.com/questions/29129814
复制相似问题