This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-handbook.git


The following commit(s) were added to refs/heads/master by this push:
     new 3bc79cb  use window.addEventListener instead of window.onresize
3bc79cb is described below

commit 3bc79cbdb36e6120842ce18767896e0913197680
Author: plainheart <[email protected]>
AuthorDate: Mon Jan 16 18:10:57 2023 +0800

    use window.addEventListener instead of window.onresize
---
 contents/en/concepts/chart-size.md | 6 +++---
 contents/zh/concepts/chart-size.md | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/contents/en/concepts/chart-size.md 
b/contents/en/concepts/chart-size.md
index 23290f8..4482974 100644
--- a/contents/en/concepts/chart-size.md
+++ b/contents/en/concepts/chart-size.md
@@ -41,7 +41,7 @@ In some cases, we want to accordingly change the chart size 
while the size of co
 
 For instance, the container has a height of 400px and a width of 100% site 
width. If you are willing to change the site width while stable the chart width 
as 100% of it, try the following method.
 
-You can listen to `window.onresize` of the site to catch the event that the 
browser is resized. Then use 
[`echartsInstance.resize`](${mainSitePath}api.html#echartsInstance.resize) to 
resize the chart.
+You can listen to `resize` of the site to catch the event that the browser is 
resized. Then use 
[`echartsInstance.resize`](${mainSitePath}api.html#echartsInstance.resize) to 
resize the chart.
 
 ```html
 <style>
@@ -57,9 +57,9 @@ You can listen to `window.onresize` of the site to catch the 
event that the brow
 <div id="main"></div>
 <script type="text/javascript">
   var myChart = echarts.init(document.getElementById('main'));
-  window.onresize = function() {
+  window.addEventListener('resize', function() {
     myChart.resize();
-  };
+  });
 </script>
 ```
 
diff --git a/contents/zh/concepts/chart-size.md 
b/contents/zh/concepts/chart-size.md
index 73e3f95..bed7cd2 100644
--- a/contents/zh/concepts/chart-size.md
+++ b/contents/zh/concepts/chart-size.md
@@ -41,7 +41,7 @@
 
 比如,图表容器是一个高度为 400px、宽度为页面 100% 的节点,你希望在浏览器宽度改变的时候,始终保持图表宽度是页面的 100%。
 
-这种情况下,可以监听页面的 `window.onresize` 事件获取浏览器大小改变的事件,然后调用 
[`echartsInstance.resize`](${mainSitePath}api.html#echartsInstance.resize) 
改变图表的大小。
+这种情况下,可以监听页面的 `resize` 事件获取浏览器大小改变的事件,然后调用 
[`echartsInstance.resize`](${mainSitePath}api.html#echartsInstance.resize) 
改变图表的大小。
 
 ```html
 <style>
@@ -57,9 +57,9 @@
 <div id="main"></div>
 <script type="text/javascript">
   var myChart = echarts.init(document.getElementById('main'));
-  window.onresize = function() {
+  window.addEventListener('resize', function() {
     myChart.resize();
-  };
+  });
 </script>
 ```
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to