如何让这个Javascript代码响应任何屏幕?

问题描述 投票:-1回答:1

我一直在努力,但没有成功,使这个代码响应。自动调整使图表太平,如果我使用高度和宽度,它只适用于某些屏幕。

有任何想法吗?

高度和宽度

<!-- TradingView Widget BEGIN -->
<script type="text/javascript"
src="https://d33t3vvu2t2yu5.cloudfront.net/tv.js"></script>
<script type="text/javascript">
new TradingView.widget({
"width": 800,
"height": 600,
"symbol": "INDEX:MERV",
"interval": "D",
"timezone": "Etc/UTC",
"theme": "White",
"style": "1",
"locale": "es",
"toolbar_bg": "#f1f3f6",
"enable_publishing": false,
"allow_symbol_change": true,
"hideideas": true,
"show_popup_button": true,
"popup_width": "1000",
"popup_height": "650"
});
</script>
<!-- TradingView Widget END -->

自动调整大小

<!-- TradingView Widget BEGIN -->
<script     type="text/javascript"
src="https://d33t3vvu2t2yu5.cloudfront.net/tv.js"></script>
<script type="text/javascript">
new TradingView.widget({
"autosize": true,
"symbol": "INDEX:MERV",
"interval": "D",
"timezone": "Etc/UTC",
"theme": "White",
"style": "1",
"locale": "es",
"toolbar_bg": "#f1f3f6",
"enable_publishing": false,
"allow_symbol_change": true,
"hideideas": true,
"show_popup_button": true,
"popup_width": "1000",
"popup_height": "650"
});
 </script>
<!-- TradingView Widget END -->

谢谢!!

javascript
1个回答
0
投票

使用自动调整大小但尝试将图表放在具有已定义的最大宽度和最大高度的容器中(或根据媒体查询定义不同的宽度/高度)。

© www.soinside.com 2019 - 2024. All rights reserved.