javascript - 使用基于 JSON 数据的 JavaScript 旋转风玫瑰图标
问题描述
我正在尝试旋转静态指南针图标(称为towards-0-deg
/ f0b1)以反映风向。
我试过了windRose = iconRotate.rotate(data.weather.deg);
,后来windElement.innerHTML = ` ${windRose.rotate(data.weather.deg)}` + `${weather.wind} km/h`;
我得到了:Uncaught (in promise) ReferenceError: iconRotate is not defined。
我在这里做错了什么?
解决方案
我设法像这样修复它:
weather.rose = function(){
$(".wi-wind").addClass("from-" + windDirection + "-deg")
setTimeout(function (){
$("#roseIcon").removeClass();
setTimeout(function () {
$("#roseIcon").addClass(`wi` +` `+ `wi-wind` +` `+ `from-` + windDirection + `-deg`)}, 1000)
},920000)
};
推荐阅读
- css - 使用 css 样式反应输入类型复选框错误
- elasticsearch - 弹性建议器为空
- hibernate - 在运行时禁用 Hibernate 二级缓存
- sql - ORA-00904: 无效的标识符。"TT"."H_NO": 无效标识符
- java - 隐藏用户输入的敏感数据
- raspberry-pi - 通过 MQTT 与 Raspberry Pi 通信时 ESP8266 中的错误检测和错误处理
- java - 即使没有依赖关系,Spring boot rabbitmq 连接也会拒绝
- android - 关闭系统默认启动器
- amazon-s3 - 为 aws 公共 s3 存储桶创建 DNS URL
- c++ - 你能告诉我为什么会出现这个错误吗?它涉及函数指针