|
|
|
@ -937,11 +937,20 @@ c3_chart_internal_fn.bindResize = function () {
|
|
|
|
|
$$.resizeFunction.add(function () { |
|
|
|
|
config.onresized.call($$); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var resizeIfElementDisplayed = function() { |
|
|
|
|
// if element not displayed skip it
|
|
|
|
|
if (!$$.api.element.offsetParent) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$$.resizeFunction(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (window.attachEvent) { |
|
|
|
|
window.attachEvent('onresize', $$.resizeFunction); |
|
|
|
|
window.attachEvent('onresize', resizeIfElementDisplayed); |
|
|
|
|
} else if (window.addEventListener) { |
|
|
|
|
window.addEventListener('resize', $$.resizeFunction, false); |
|
|
|
|
window.addEventListener('resize', resizeIfElementDisplayed, false); |
|
|
|
|
} else { |
|
|
|
|
// fallback to this, if this is a very old browser
|
|
|
|
|
var wrapper = window.onresize; |
|
|
|
@ -955,7 +964,14 @@ c3_chart_internal_fn.bindResize = function () {
|
|
|
|
|
} |
|
|
|
|
// add this graph to the wrapper, we will be removed if the user calls destroy
|
|
|
|
|
wrapper.add($$.resizeFunction); |
|
|
|
|
window.onresize = wrapper; |
|
|
|
|
window.onresize = function() { |
|
|
|
|
// if element not displayed skip it
|
|
|
|
|
if (!$$.api.element.offsetParent) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
wrapper(); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|