gpt4 book ai didi

javascript - 根据移动设备屏幕尺寸动态设置 HighCharts marginTop

转载 作者:行者123 更新时间:2023-12-03 07:12:31 25 4
gpt4 key购买 nike

如何设置marginTop根据当前窗口高度动态变化?

例如

$scope.chartConfig = {
options: {
chart: {
type: 'solidgauge',
// set to -50 if window height is 700px...
// set to -20 if window height is 500px...
marginTop: -50
}
}
}

最佳答案

我是这样解决的:

function ChartController($scope, $window) {
$scope.chartConfig = {
options: {
chart: {
type: 'solidgauge',
// set to -50 if window height is 700px...
// set to -20 if window height is 500px...
marginTop: 0
}
}
}

if ($window.innerHeight >= 568 && $window.innerHeight <= 639) {
$scope.chartConfig.options.chart.marginTop = -95;
}
}

关于javascript - 根据移动设备屏幕尺寸动态设置 HighCharts marginTop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36571256/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com