<分区>
<分区>
我所做的是这样的:
现在,问题是,每个图都被一个具有最小宽度的 div 包裹着,在我第一次加载页面时,其中的 20 个被隐藏了。
当用户点击按钮显示另一组绘图时,宽度设置不正确。
我在这里写了一个非常快速的演示来展示我的问题:http://jsfiddle.net/k5adky9d/4/
<div id="wrapper" style="min-width:300px; display:none"><!--please remove the display:none here to view the correct results-->
<h2>plot subject</h2>
<div id="container" style=" height: 400px; margin: 0 auto" >
</div>
$(function () {
//$('#wrapper').hide();//I can also use hide() here if the originally 'display' is not set to none
$('#btn').on('click',function(){
$('#wrapper').show();//after show, the plot'width is not adjust to what it should be, it only adjust the the min-width(300px)
});
$('#container').highcharts({...})
})
最佳答案
尝试将你的 JS 重构成这样:
$(function () {
$('#btn').on('click', function () {
$('#wrapper').show(function () {
.....<highcharts code here>...
});
});
});
可以引用这个fiddle .
关于javascript - Highcharts 的宽度未在隐藏的 div 处正确呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29340491/