如何设置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/